File tree Expand file tree Collapse file tree 6 files changed +35
-8
lines changed
prev_api_changes/api_changes_3.5.0 Expand file tree Collapse file tree 6 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -69,4 +69,6 @@ Colormaps and color sequences
69
69
Miscellaneous
70
70
=============
71
71
72
+ .. autoclass :: MatplotlibDeprecationWarning
73
+
72
74
.. autofunction :: get_cachedir
Original file line number Diff line number Diff line change
1
+ Deprecation aliases in cbook
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
+
4
+ The module ``matplotlib.cbook.deprecation `` was previously deprecated in
5
+ Matplotlib 3.4, along with deprecation-related API in ``matplotlib.cbook ``. Due
6
+ to technical issues, ``matplotlib.cbook.MatplotlibDeprecationWarning `` and
7
+ ``matplotlib.cbook.mplDeprecation `` did not raise deprecation warnings on use.
8
+ Changes in Python have now made it possible to warn when these aliases are
9
+ being used.
10
+
11
+ In order to avoid downstream breakage, these aliases will now warn, and their
12
+ removal has been pushed from 3.6 to 3.8 to give time to notice said warnings.
13
+ As replacement, please use `matplotlib.MatplotlibDeprecationWarning `.
Original file line number Diff line number Diff line change @@ -3,5 +3,4 @@ Removal of deprecations in ``cbook``
3
3
4
4
The module ``cbook.deprecation `` is removed from the public API as it is
5
5
considered internal. This also holds for deprecation-related re-imports in
6
- ``cbook ``: ``deprecated ``, ``MatplotlibDeprecationWarning ``,
7
- ``mplDeprecation ``, and ``warn_deprecated ``.
6
+ ``cbook ``: ``deprecated ``, and ``warn_deprecated ``.
Original file line number Diff line number Diff line change @@ -47,16 +47,16 @@ corresponding ``Axes.add_*`` method.
47
47
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
48
49
49
Historically, it has not been possible to filter
50
- `.MatplotlibDeprecationWarning `\s by checking for ` DeprecationWarning `, since we
51
- subclass `UserWarning ` directly.
50
+ `~matplotlib .MatplotlibDeprecationWarning `\s by checking for
51
+ ` DeprecationWarning `, since we subclass `UserWarning ` directly.
52
52
53
53
The decision to not subclass `DeprecationWarning ` has to do with a decision
54
54
from core Python in the 2.x days to not show `DeprecationWarning `\s to users.
55
55
However, there is now a more sophisticated filter in place (see
56
56
https://www.python.org/dev/peps/pep-0565/).
57
57
58
- Users will now see `.MatplotlibDeprecationWarning ` only during interactive
59
- sessions, and these can be silenced by the standard mechanism:
58
+ Users will now see `~matplotlib .MatplotlibDeprecationWarning ` only during
59
+ interactive sessions, and these can be silenced by the standard mechanism:
60
60
61
61
.. code :: python
62
62
Original file line number Diff line number Diff line change @@ -322,8 +322,8 @@ Introducing
322
322
1. Announce the deprecation in a new file
323
323
:file: `doc/api/next_api_changes/deprecations/99999-ABC.rst ` where ``99999 ``
324
324
is the pull request number and ``ABC `` are the contributor's initials.
325
- 2. If possible, issue a `.MatplotlibDeprecationWarning ` when the deprecated
326
- API is used. There are a number of helper tools for this:
325
+ 2. If possible, issue a `~matplotlib .MatplotlibDeprecationWarning ` when the
326
+ deprecated API is used. There are a number of helper tools for this:
327
327
328
328
- Use ``_api.warn_deprecated() `` for general deprecation warnings
329
329
- Use the decorator ``@_api.deprecated `` to deprecate classes, functions,
Original file line number Diff line number Diff line change 30
30
from matplotlib import _api , _c_internal_utils
31
31
32
32
33
+ @_api .caching_module_getattr
34
+ class __getattr__ :
35
+ # module-level deprecations
36
+ MatplotlibDeprecationWarning = _api .deprecated (
37
+ "3.6" , obj_type = "" ,
38
+ alternative = "matplotlib.MatplotlibDeprecationWarning" )(
39
+ property (lambda self : _api .deprecation .MatplotlibDeprecationWarning ))
40
+ mplDeprecation = _api .deprecated (
41
+ "3.6" , obj_type = "" ,
42
+ alternative = "matplotlib.MatplotlibDeprecationWarning" )(
43
+ property (lambda self : _api .deprecation .MatplotlibDeprecationWarning ))
44
+
45
+
33
46
def _get_running_interactive_framework ():
34
47
"""
35
48
Return the interactive framework whose event loop is currently running, if
You can’t perform that action at this time.
0 commit comments