Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d30a1a

Browse files
authored
Merge pull request #21651 from meeseeksmachine/auto-backport-of-pr-21626-on-v3.5.x
Backport PR #21626 on branch v3.5.x (Added the definition of Deprecation and made Deprecation Process clearer)
2 parents 8be9ce3 + 4975207 commit 9d30a1a

File tree

1 file changed

+52
-24
lines changed

1 file changed

+52
-24
lines changed

doc/devel/contributing.rst

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,30 +275,58 @@ Coding guidelines
275275
API changes
276276
-----------
277277

278-
Changes to the public API must follow a standard deprecation procedure to
279-
prevent unexpected breaking of code that uses Matplotlib.
280-
281-
- Deprecations must be announced via a new file in
282-
a new file in :file:`doc/api/next_api_changes/deprecations/` with
283-
naming convention ``99999-ABC.rst`` where ``99999`` is the pull request
284-
number and ``ABC`` are the contributor's initials.
285-
- Deprecations are targeted at the next point-release (i.e. 3.x.0).
286-
- The deprecated API should, to the maximum extent possible, remain fully
287-
functional during the deprecation period. In cases where this is not
288-
possible, the deprecation must never make a given piece of code do something
289-
different than it was before; at least an exception should be raised.
290-
- If possible, usage of an deprecated API should emit a
291-
`.MatplotlibDeprecationWarning`. There are a number of helper tools for this:
292-
293-
- Use ``_api.warn_deprecated()`` for general deprecation warnings.
294-
- Use the decorator ``@_api.deprecated`` to deprecate classes, functions,
295-
methods, or properties.
296-
- To warn on changes of the function signature, use the decorators
297-
``@_api.delete_parameter``, ``@_api.rename_parameter``, and
298-
``@_api.make_keyword_only``.
299-
300-
- Deprecated API may be removed two point-releases after they were deprecated.
301-
278+
API consistency and stability are of great value. Therefore, API changes
279+
(e.g. signature changes, behavior changes, removals) will only be conducted
280+
if the added benefit is worth the user effort for adapting.
281+
282+
API changes in Matplotlib have to be performed following the deprecation process
283+
below, except in very rare circumstances as deemed necessary by the development team.
284+
This ensures that users are notified before the change will take effect and thus
285+
prevents unexpected breaking of code.
286+
287+
Rules
288+
~~~~~
289+
290+
- Deprecations are targeted at the next point.release (e.g. 3.x)
291+
- Deprecated API is generally removed two two point-releases after introduction
292+
of the deprecation. Longer deprecations can be imposed by core developers on
293+
a case-by-case basis to give more time for the transition
294+
- The old API must remain fully functional during the deprecation period
295+
- If alternatives to the deprecated API exist, they should be available
296+
during the deprecation period
297+
- If in doubt, decisions about API changes are finally made by the
298+
API consistency lead developer
299+
300+
Introducing
301+
~~~~~~~~~~~
302+
303+
1. Announce the deprecation in a new file
304+
:file:`doc/api/next_api_changes/deprecations/99999-ABC.rst` where ``99999``
305+
is the pull request number and ``ABC`` are the contributor's initials.
306+
2. If possible, issue a `.MatplotlibDeprecationWarning` when the deprecated
307+
API is used. There are a number of helper tools for this:
308+
309+
- Use ``_api.warn_deprecated()`` for general deprecation warnings
310+
- Use the decorator ``@_api.deprecated`` to deprecate classes, functions,
311+
methods, or properties
312+
- To warn on changes of the function signature, use the decorators
313+
``@_api.delete_parameter``, ``@_api.rename_parameter``, and
314+
``@_api.make_keyword_only``
315+
316+
All these helpers take a first parameter *since*, which should be set to
317+
the next point release, e.g. "3.x".
318+
319+
Expiring
320+
~~~~~~~~
321+
322+
1. Announce the API changes in a new file
323+
:file:`doc/api/next_api_changes/[kind]/99999-ABC.rst` where ``99999``
324+
is the pull request number and ``ABC`` are the contributor's initials, and
325+
``[kind]`` is one of the folders :file:`behavior`, :file:`development`,
326+
:file:`removals`. See :file:`doc/api/next_api_changes/README.rst` for more
327+
information. For the content, you can usually copy the deprecation notice
328+
and adapt it slightly.
329+
2. Change the code functionality and remove any related deprecation warnings.
302330

303331
Adding new API
304332
--------------

0 commit comments

Comments
 (0)