8000 Merge pull request #29375 from story645/api-change · matplotlib/matplotlib@3703110 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3703110

Browse files
authored
Merge pull request #29375 from story645/api-change
Doc: document pending deprecation procedure
2 parents 2b3eea5 + 76eea4c commit 3703110

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

doc/devel/api_changes.rst

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ team. Generally API deprecation happens in two stages:
6262
* **expire:** API *is* changed as described in the introduction period
6363

6464
This ensures that users are notified before the change will take effect and thus
65-
prevents unexpected breaking of code.
65+
prevents unexpected breaking of code. Occasionally deprecations are marked as
66+
**pending**, which means that the deprecation will be introduced in a future release.
6667

6768
Rules
6869
^^^^^
69-
- Deprecations are targeted at the next :ref:`meso release <pr-milestones>` (e.g. 3.x)
70+
- Deprecations are targeted at the next :ref:`meso release <pr-milestones>` (e.g. 3.Y)
7071
- Deprecated API is generally removed (expired) two point-releases after introduction
7172
of the deprecation. Longer deprecations can be imposed by core developers on
7273
a case-by-case basis to give more time for the transition
@@ -76,12 +77,17 @@ Rules
7677
- If in doubt, decisions about API changes are finally made by the
7778
`API consistency lead <https://matplotlib.org/governance/people.html>`_ developer.
7879

80+
7981
.. _intro-deprecation:
8082

8183
Introduce deprecation
8284
^^^^^^^^^^^^^^^^^^^^^
8385

84-
#. Create :ref:`deprecation notice <api_whats_new>`
86+
Deprecations are introduced to warn users that the API will change. The deprecation
87+
notice describes how the API will change. When alternatives to the deprecated API exist,
88+
they are also listed in the notice and decorators.
89+
90+
#. Create a :ref:`deprecation notice <api_whats_new>`
8591

8692
#. If possible, issue a `~matplotlib.MatplotlibDeprecationWarning` when the
8793
deprecated API is used. There are a number of helper tools for this:
@@ -117,8 +123,10 @@ Introduce deprecation
117123

118124
Expire deprecation
119125
^^^^^^^^^^^^^^^^^^
126+
The API changes described in the introduction notice are only implemented after the
127+
introduction period has expired.
120128

121-
#. Create :ref:`deprecation announcement <api_whats_new>`. For the content,
129+
#. Create a :ref:`deprecation announcement <api_whats_new>`. For the content,
122130
you can usually copy the deprecation notice and adapt it slightly.
123131

124132
#. Change the code functionality and remove any related deprecation warnings.
@@ -137,6 +145,35 @@ Expire deprecation
137145
instead. For removed items that were not in the stub file, only deleting from the
138146
allowlist is required.
139147

148+
.. _pending-deprecation:
149+
150+
Pending deprecation
151+
^^^^^^^^^^^^^^^^^^^
152+
153+
A pending deprecation is an announcement that a deprecation will be introduced in the
154+
future. By default, pending deprecations do not raise a warning to the user; however,
155+
pending deprecations are rendered in the documentation and listed in the release notes.
156+
Pending notices are primarily intended to give downstream library and tool developers
157+
time to adapt their code so that it does not raise a deprecation
158+
warning. This is because their users cannot act on warnings triggered by how the tools
159+
and libraries use Matplotlib. It's also possible to run Python in dev mode to raise
160+
`PendingDeprecationWarning`.
161+
162+
To mark a deprecation as pending, set the following parameters on the appropriate
163+
deprecation decorator:
164+
* the *pending* parameter is set to ``True``
165+
* the *removal* parameter is left blank
166+
167+
When converting a pending deprecation to an introduced deprecation, update the
168+
decorator such that:
169+
* *pending* is set to ``False``
170+
* *since* is set to the next meso release (3.Y+1)
171+
* *removal* is set to at least 2 meso releases after (3.Y+3) introduction.
172+
173+
Pending deprecations are documented in the :ref:`API change notes <api_whats_new>` in
174+
the same manner as introduced and expired deprecations. The notice should include
175+
*pending deprecation* in the title.
176+
140177

141178
.. redirect-from:: /devel/coding_guide#new-features-and-api-changes
142179

0 commit comments

Comments
 (0)
0