From e745f28f168caf4022367fce22561a5ed26fa39e Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Fri, 29 Sep 2023 14:59:27 -0400 Subject: [PATCH 01/14] remove deprecated class PsBackendHelper Signed-off-by: Issam Arabi --- lib/matplotlib/backends/backend_ps.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index dad3049f51da..3cdd2d4293d8 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -39,11 +39,6 @@ debugPS = False -@_api.deprecated("3.7") -class PsBackendHelper: - def __init__(self): - self._cached = {} - @_api.caching_module_getattr class __getattr__: From 1e61d8f3c90e4f72896a2c9ba4d812edb006bb27 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Fri, 29 Sep 2023 14:59:51 -0400 Subject: [PATCH 02/14] remove deprecated class ServerThread Signed-off-by: Issam Arabi --- lib/matplotlib/backends/backend_webagg.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/matplotlib/backends/backend_webagg.py b/lib/matplotlib/backends/backend_webagg.py index 14c0b525fb8f..25f97b10279e 100644 --- a/lib/matplotlib/backends/backend_webagg.py +++ b/lib/matplotlib/backends/backend_webagg.py @@ -37,11 +37,6 @@ TimerAsyncio, TimerTornado) -@mpl._api.deprecated("3.7") -class ServerThread(threading.Thread): - def run(self): - tornado.ioloop.IOLoop.instance().start() - webagg_server_thread = threading.Thread( target=lambda: tornado.ioloop.IOLoop.instance().start()) From 70c6723e6680ccd67e5ff92f10562d48c707be2f Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Fri, 29 Sep 2023 15:09:29 -0400 Subject: [PATCH 03/14] remove deprecated class PsBackendHelper dependency Signed-off-by: Issam Arabi --- lib/matplotlib/backends/backend_ps.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 3cdd2d4293d8..a7304ba50def 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -43,8 +43,6 @@ @_api.caching_module_getattr class __getattr__: # module-level deprecations - ps_backend_helper = _api.deprecated("3.7", obj_type="")( - property(lambda self: PsBackendHelper())) psDefs = _api.deprecated("3.8", obj_type="")(property(lambda self: _psDefs)) From e1916bbcbfe14deb11dab1b593437021a5ab2060 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Fri, 29 Sep 2023 15:18:49 -0400 Subject: [PATCH 04/14] remove blank lines Signed-off-by: Issam Arabi --- lib/matplotlib/backends/backend_ps.py | 1 - lib/matplotlib/backends/backend_webagg.py | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index a7304ba50def..d760bef04d19 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -39,7 +39,6 @@ debugPS = False - @_api.caching_module_getattr class __getattr__: # module-level deprecations diff --git a/lib/matplotlib/backends/backend_webagg.py b/lib/matplotlib/backends/backend_webagg.py index 25f97b10279e..dfc5747ef77c 100644 --- a/lib/matplotlib/backends/backend_webagg.py +++ b/lib/matplotlib/backends/backend_webagg.py @@ -37,7 +37,6 @@ TimerAsyncio, TimerTornado) - webagg_server_thread = threading.Thread( target=lambda: tornado.ioloop.IOLoop.instance().start()) From 0600ce62bc13f8a7a7ab9a1b2401755671fcced4 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Sat, 30 Sep 2023 10:08:37 -0400 Subject: [PATCH 05/14] Delete deprecated C++ methods PyBufferRegion_to_string and PyBufferRegion_to_string_argb This commit removes two deprecated methods, PyBufferRegion_to_string and PyBufferRegion_to_string_argb, from src/_backend_agg_wrapper.cpp, deprecated since version 3.7. Signed-off-by: Issam Arabi --- src/_backend_agg_wrapper.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index d4ce224d93c3..ce9593265ef9 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -44,18 +44,6 @@ static void PyBufferRegion_dealloc(PyBufferRegion *self) Py_TYPE(self)->tp_free((PyObject *)self); } -static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args) -{ - char const* msg = - "BufferRegion.to_string is deprecated since Matplotlib 3.7 and will " - "be removed two minor releases later; use np.asarray(region) instead."; - if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) { - return NULL; - } - return PyBytes_FromStringAndSize((const char *)self->x->get_data(), - (Py_ssize_t) self->x->get_height() * self->x->get_stride()); -} - /* TODO: This doesn't seem to be used internally. Remove? */ static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args) @@ -87,28 +75,6 @@ static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args return Py_BuildValue("IIII", rect.x1, rect.y1, rect.x2, rect.y2); } -static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args) -{ - char const* msg = - "BufferRegion.to_string_argb is deprecated since Matplotlib 3.7 and " - "will be removed two minor releases later; use " - "np.take(region, [2, 1, 0, 3], axis=2) instead."; - if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) { - return NULL; - } - PyObject *bufobj; - uint8_t *buf; - Py_ssize_t height, stride; - height = self->x->get_height(); - stride = self->x->get_stride(); - bufobj = PyBytes_FromStringAndSize(NULL, height * stride); - buf = (uint8_t *)PyBytes_AS_STRING(bufobj); - - CALL_CPP_CLEANUP("to_string_argb", (self->x->to_string_argb(buf)), Py_DECREF(bufobj)); - - return bufobj; -} - int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags) { Py_INCREF(self); From 7633fff91353bdc21f7b8ed3fec6372f9d1fa587 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Sat, 30 Sep 2023 10:09:42 -0400 Subject: [PATCH 06/14] Update API change notes to document removal of deprecated classes and methods from 3.7 This commit updates the API change notes to reflect the removal of deprecated Python classes and C++ methods. Signed-off-by: Issam Arabi --- .../next_api_changes/removals/26962-IA.rst | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/api/next_api_changes/removals/26962-IA.rst diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst new file mode 100644 index 000000000000..dcd7e519dced --- /dev/null +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -0,0 +1,22 @@ +Removal change template +~~~~~~~~~~~~~~~~~~~~~~~ + +Deprecated Classes Removed +########################## + +The following deprecated classes from version 3.7 have been removed: + +- `matplotlib.backends.backend_ps.PsBackendHelper` +- `matplotlib.backends.backend_webagg.ServerThread` + +These classes were previously marked as deprecated and have now been removed in accordance with the deprecation cycle. + +Deprecated C++ Methods Removed +############################## + +The following deprecated C++ methods from `src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed: + +- `PyBufferRegion_to_string` +- `PyBufferRegion_to_string_argb` + +These methods were previously marked as deprecated and have now been removed. \ No newline at end of file From 4536e960dc15013c0148c88515d5b62db50de1bc Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Sat, 30 Sep 2023 10:21:42 -0400 Subject: [PATCH 07/14] Remove deprecated PyBufferRegion methods from _backend_agg_wrapper.cpp Removed `to_string` and `to_string_argb` methods from `PyBufferRegion_init_type` Signed-off-by: Issam Arabi --- src/_backend_agg_wrapper.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index ce9593265ef9..eaf4bf6f5f9d 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -102,8 +102,6 @@ int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags) static PyTypeObject *PyBufferRegion_init_type() { static PyMethodDef methods[] = { - { "to_string", (PyCFunction)PyBufferRegion_to_string, METH_NOARGS, NULL }, - { "to_string_argb", (PyCFunction)PyBufferRegion_to_string_argb, METH_NOARGS, NULL }, { "set_x", (PyCFunction)PyBufferRegion_set_x, METH_VARARGS, NULL }, { "set_y", (PyCFunction)PyBufferRegion_set_y, METH_VARARGS, NULL }, { "get_extents", (PyCFunction)PyBufferRegion_get_extents, METH_NOARGS, NULL }, From 24b56c6f22626a538333aca41c9fc9b9fea1ca88 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Thu, 5 Oct 2023 09:14:25 -0400 Subject: [PATCH 08/14] Update format of API change note Signed-off-by: Issam Arabi --- doc/api/next_api_changes/removals/26962-IA.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst index dcd7e519dced..5e8661afbd51 100644 --- a/doc/api/next_api_changes/removals/26962-IA.rst +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -1,18 +1,15 @@ -Removal change template -~~~~~~~~~~~~~~~~~~~~~~~ - Deprecated Classes Removed -########################## +~~~~~~~~~~~~~~~~~~~~~~~ The following deprecated classes from version 3.7 have been removed: -- `matplotlib.backends.backend_ps.PsBackendHelper` -- `matplotlib.backends.backend_webagg.ServerThread` +- ``matplotlib.backends.backend_ps.PsBackendHelper`` +- ``matplotlib.backends.backend_webagg.ServerThread`` These classes were previously marked as deprecated and have now been removed in accordance with the deprecation cycle. Deprecated C++ Methods Removed -############################## +~~~~~~~~~~~~~~~~~~~~~~~ The following deprecated C++ methods from `src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed: From f7c4f30ef0be96eacf21c061fc306b6a95a6541b Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Thu, 5 Oct 2023 09:15:40 -0400 Subject: [PATCH 09/14] remove to_string_argb Signed-off-by: Issam Arabi --- src/_backend_agg.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp index aec7676b7951..10a17f2dc9cb 100644 --- a/src/_backend_agg.cpp +++ b/src/_backend_agg.cpp @@ -5,26 +5,6 @@ #include "_backend_agg.h" #include "mplutils.h" -void BufferRegion::to_string_argb(uint8_t *buf) -{ - unsigned char *pix; - unsigned char tmp; - size_t i, j; - - memcpy(buf, data, (size_t) height * stride); - - for (i = 0; i < (size_t)height; ++i) { - pix = buf + i * stride; - for (j = 0; j < (size_t)width; ++j) { - // Convert rgba to argb - tmp = pix[2]; - pix[2] = pix[0]; - pix[0] = tmp; - pix += 4; - } - } -} - RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi) : width(width), height(height), From 47dae239c07cbe8bef5e47fb5513a8d194a7ade8 Mon Sep 17 00:00:00 2001 From: Issam Date: Sat, 7 Oct 2023 09:28:08 -0400 Subject: [PATCH 10/14] Update doc format Co-authored-by: Kyle Sunden --- doc/api/next_api_changes/removals/26962-IA.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst index 5e8661afbd51..9596f1070c46 100644 --- a/doc/api/next_api_changes/removals/26962-IA.rst +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -9,7 +9,7 @@ The following deprecated classes from version 3.7 have been removed: These classes were previously marked as deprecated and have now been removed in accordance with the deprecation cycle. Deprecated C++ Methods Removed -~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following deprecated C++ methods from `src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed: From ab08ae780668ec80fa2559cc43cf2136857faf08 Mon Sep 17 00:00:00 2001 From: Issam Date: Sat, 7 Oct 2023 09:28:19 -0400 Subject: [PATCH 11/14] Update doc/api/next_api_changes/removals/26962-IA.rst Update doc format Co-authored-by: Elliott Sales de Andrade --- doc/api/next_api_changes/removals/26962-IA.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst index 9596f1070c46..81ec8295a978 100644 --- a/doc/api/next_api_changes/removals/26962-IA.rst +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -1,5 +1,5 @@ Deprecated Classes Removed -~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ The following deprecated classes from version 3.7 have been removed: From d631798b74b85099e92f1ffff404beae36a6f055 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Sat, 7 Oct 2023 09:31:47 -0400 Subject: [PATCH 12/14] remove to_string_argb declaration Signed-off-by: Issam Arabi --- src/_backend_agg.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/_backend_agg.h b/src/_backend_agg.h index 9f67c77eab64..c191f3448144 100644 --- a/src/_backend_agg.h +++ b/src/_backend_agg.h @@ -86,8 +86,6 @@ class BufferRegion return stride; } - void to_string_argb(uint8_t *buf); - private: agg::int8u *data; agg::rect_i rect; From 1d45c3dbea373b00fcee57181df0b9ae4c706486 Mon Sep 17 00:00:00 2001 From: Issam Arabi Date: Thu, 2 Nov 2023 08:29:58 -0400 Subject: [PATCH 13/14] refactor --- doc/api/next_api_changes/removals/26962-IA.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst index 81ec8295a978..6069f4200ca2 100644 --- a/doc/api/next_api_changes/removals/26962-IA.rst +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -16,4 +16,4 @@ The following deprecated C++ methods from `src/_backend_agg_wrapper.cpp`, deprec - `PyBufferRegion_to_string` - `PyBufferRegion_to_string_argb` -These methods were previously marked as deprecated and have now been removed. \ No newline at end of file +These methods were previously marked as deprecated and have now been removed. From 75684d393fd2f42a55f57f2954093d2a72d3361e Mon Sep 17 00:00:00 2001 From: Issam Date: Tue, 7 Nov 2023 10:46:36 -0500 Subject: [PATCH 14/14] Update formatting of note Co-authored-by: Kyle Sunden --- doc/api/next_api_changes/removals/26962-IA.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/next_api_changes/removals/26962-IA.rst b/doc/api/next_api_changes/removals/26962-IA.rst index 6069f4200ca2..ac1ab46944b6 100644 --- a/doc/api/next_api_changes/removals/26962-IA.rst +++ b/doc/api/next_api_changes/removals/26962-IA.rst @@ -11,9 +11,9 @@ These classes were previously marked as deprecated and have now been removed in Deprecated C++ Methods Removed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following deprecated C++ methods from `src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed: +The following deprecated C++ methods from :file:`src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed: -- `PyBufferRegion_to_string` -- `PyBufferRegion_to_string_argb` +- ``PyBufferRegion_to_string`` +- ``PyBufferRegion_to_string_argb`` These methods were previously marked as deprecated and have now been removed.