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