Title: [MNT]: Remove 3.7-deprecated API · Issue #26865 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Remove 3.7-deprecated API · Issue #26865 · matplotlib/matplotlib
X Title: [MNT]: Remove 3.7-deprecated API · Issue #26865 · matplotlib/matplotlib
Description: Summary As old and unused API (classes, methods, functions) are found, they are marked deprecated with removal intended in a later release. These API are decorated or otherwise wrapped with the deprecation functions in _api (i.e., deprec...
Open Graph Description: Summary As old and unused API (classes, methods, functions) are found, they are marked deprecated with removal intended in a later release. These API are decorated or otherwise wrapped with the dep...
X Description: Summary As old and unused API (classes, methods, functions) are found, they are marked deprecated with removal intended in a later release. These API are decorated or otherwise wrapped with the dep...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26865
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Remove 3.7-deprecated API","articleBody":"# Summary\r\n\r\nAs old and unused API (classes, methods, functions) are found, they are marked deprecated with removal intended in a later release. These API are decorated or otherwise wrapped with [the deprecation functions in `_api`](https://github.com/matplotlib/matplotlib/blob/dceb278bef361f32eb0009dec5bfda41fc27fa38/lib/matplotlib/_api/__init__.py#L19-L22) (i.e., `deprecated`, `warn_deprecated`, `rename_parameter`, `delete_parameter`, `make_keyword_only`, `deprecate_method_override`, or `deprecate_privatize_attribute`).\r\n\r\nNow that 3.8 is out and `main` targets 3.9, we can start the process of removing API that were deprecated in 3.7 (i.e., those with `since=\"3.7\"` and without `pending=True`).\r\n\r\n# Proposed fix\r\n\r\nEach part of the deprecated API should be removed:\r\n1. The deprecated code itself:\r\n a. Items marked with `_api.warn_deprecated`, `@_api.deprecated` or `@_api.deprecate_privatize_attribute` are to be removed on expiry, i.e., any of the marked lines below:\r\n ```diff\r\n -@api.deprecated(\"3.7\", ...)\r\n -def foo():\r\n - pass\r\n\r\n def bar(x):\r\n if x is None:\r\n - _api.warn_deprecated(\"3.7\", message=\"x=None is deprecated\")\r\n + raise ValueError(\"x=None is not supported\")\r\n ...\r\n\r\n class Baz:\r\n ...\r\n - value = _api.deprecate_privatize_attribute(\"3.7\", ...)\r\n ```\r\n b. Items decorated with `@_api.rename_parameter` should have this decorator removed, and no other changes will be necessary (the parameter rename should already have been made when the decorator was added.), i.e.,\r\n ```diff\r\n -@_api.rename_parameter(\"3.7\", \"old_name\", \"new_name\")\r\n def foo(new_name):\r\n ...\r\n ```\r\n c. Items decorated with `@_api.make_keyword_only` should have the decorator removed, and the parameter named there should be made keyword-only (by adding a `*` before that point).\r\n ```diff\r\n -@_api.make_keyword_only(\"3.7\", \"arg3\")\r\n -def foo(arg1, arg2, arg3, arg4):\r\n +def foo(arg1, arg2, *, arg3, arg4):\r\n ...\r\n ```\r\n d. Items decorated with `@_api.delete_parameter` will need to have the parameter deleted _and_ all following parameters made keyword-only.\r\n ```diff\r\n -@_api.delete_parameter(\"3.7\", \"arg3\")\r\n -def foo(arg1, arg2, arg3, arg4):\r\n +def foo(arg1, arg2, *, arg4):\r\n ...\r\n ```\r\n3. The corresponding type stub in the related `*.pyi` file.\r\n4. Any tests for _only_ deprecated behaviour.\r\n5. Any related exceptions in `ci/mypy-stubtest-allowlist.txt`, if there are any.\r\n\r\nAdditionally, the removal should be documented by placing a snippet in `doc/api/next_api_changes/removals/` (see `00001-ABC.rst` in that directory for a template). For writing these snippets, you may wish to [copy the original deprecation notice](https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.7.0.html#deprecations), modifying it slightly to state that the API has been removed instead. Please ensure that any references to deleted API include a full path (as there may be many methods with the same name, but on different classes.)\r\n\r\n**NOTE**: After removing the deprecated API, there may be some additional fallout that should be corrected. For example,\r\n1. Removed code may be aliased by importing in another location, so those imports will have to be removed.\r\n2. Documentation may link to the removed API; these should be kept in code style. For example,\r\n ```rst\r\n This is some text referencing :class:`.RemovedClass`.\r\n ```\r\n should be changed to:\r\n ```rst\r\n This is some text referencing ``matplotlib.submodule.RemovedClass``.\r\n ```\r\n (Please expand the API into the full import name.)\r\n\r\nSee also [our documentation on removing deprecated API](https://matplotlib.org/devdocs/devel/contribute.html#expiring) and #26853 for an example removing several types of deprecated API.\r\n\r\n# Task list\r\nA quick search shows the following sets of possible parts to remove (for GHC OSD, please use Slack and/or Zoom to make sure someone else hasn't started working on the same set):\r\n1. [x] `lib/matplotlib/animation.py` - 2 deprecations #26872\r\n4. [x] `lib/matplotlib/axis.py` - 1 deprecation #26871\r\n5. [x] `lib/matplotlib/backends/*.py` - 3 deprecations and `src/_backend_agg_wrapper.cpp` - 2 deprecations #26962\r\n6. [x] `lib/matplotlib/cm.py` - 2 deprecations (Note: the documentation for this removal may be a bit tricky to write.) #26965\r\n7. [x] `lib/matplotlib/contour.py` - 5 deprecations #26907\r\n8. [x] `lib/matplotlib/collections.py` - 2 deprecations #26874\r\n9. [x] `lib/matplotlib/_fontconfig_patterns.py` - 1 deprecation #26884\r\n10. [x] `lib/matplotlib/gridspec.py` - 1 deprecation #26885 (!)\r\n11. [x] `lib/matplotlib/lines.py` - 2 deprecations #26902\r\n12. [x] `lib/matplotlib/offsetbox.py` - 3 deprecations #26910 ~~#26880~~\r\n13. [x] `lib/matplotlib/patches.py` - 1 deprecation #26890 #26876 #26900 (!)\r\n14. [x] `lib/matplotlib/quiver.py` - 2 deprecations #26918 \r\n15. [x] `lib/matplotlib/tri/*.py` - 8 deprecations #26909 \r\n16. [x] `lib/mpl_toolkits/axisartist/axislines.py` - 2 deprecations #26900\r\n\r\nThere may be some other items I've missed here, but note that we do not want to remove any with `pending=True`, or `since=\"3.8\"` or higher.","author":{"url":"https://github.com/QuLogic","@type":"Person","name":"QuLogic"},"datePublished":"2023-09-22T04:29:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/26865/matplotlib/issues/26865"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:52011a55-672a-9d4e-2db2-e04718e90dca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8566:242722:C22369:1063803:6A531CC3 |
| html-safe-nonce | 1178d918c8dca87930969787ca41e26320410af57d44a6a04b88896822d69e06 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTY2OjI0MjcyMjpDMjIzNjk6MTA2MzgwMzo2QTUzMUNDMyIsInZpc2l0b3JfaWQiOiI2OTYyNTg4NDYzMzM1MTUyODM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4433b7d0606ca23ee8326240aa20c2c99061b821f5985b700805a3f49f2a1c54 |
| hovercard-subject-tag | issue:1908162252 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/26865/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2e35088ecca14a01d02985db2c1fe1eb4d020417876046bd1d276f22940fb5e4/matplotlib/matplotlib/issues/26865 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2e35088ecca14a01d02985db2c1fe1eb4d020417876046bd1d276f22940fb5e4/matplotlib/matplotlib/issues/26865 |
| og:image:alt | Summary As old and unused API (classes, methods, functions) are found, they are marked deprecated with removal intended in a later release. These API are decorated or otherwise wrapped with the dep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | QuLogic |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width