@@ -325,6 +325,50 @@ and articles or link to it from your website!
325
325
Coding guidelines
326
326
=================
327
327
328
+ API changes
329
+ -----------
330
+
331
+ Changes to the public API must follow a standard deprecation procedure to
332
+ prevent unexpected breaking of code that uses Matplotlib.
333
+
334
+ - Deprecations must be announced via an entry in `doc/api/next_api_changes `.
335
+ - Deprecations are targeted at the next point-release (i.e. 3.x.0).
336
+ - The deprecated API should, to the maximum extent possible, remain fully
337
+ functional during the deprecation period. In cases where this is not
338
+ possible, the deprecation must never make a given piece of code do something
339
+ different than it was before; at least an exception should be raised.
340
+ - If possible, usage of an deprecated API should emit a
341
+ `MatplotlibDeprecationWarning `. There are a number of helper tools for this:
342
+
343
+ - Use `.cbook.warn_deprecated() ` for general deprecation warnings.
344
+ - Use the decorator ``@cbook.deprecated `` to deprecate classes, functions,
345
+ methods, or properties.
346
+ - To warn on changes of the function signature, use the decorators
347
+ ``@cbook._delete_parameter ``, ``@cbook._rename_parameter ``, and
348
+ ``@cbook._make_keyword_only ``.
349
+
350
+ - Deprecated API may be removed two point-releases after they were deprecated.
351
+
352
+
353
+ Adding new API
354
+ --------------
355
+
356
+ Every new function, parameter and attribute that is not explicitly marked as
357
+ private (i.e., starts with an underscore) becomes part of Matplotlib's public
358
+ API. As discussed above, changing the existing API is cumbersome. Therefore,
359
+ take particular care when adding new API:
360
+
361
+ - Mark helper functions and internal attributes as private by prefixing them
362
+ with an underscore.
363
+ - Carefully think about good names for your functions and variables.
364
+ - Try to adopt patterns and naming conventions from existing parts of the
365
+ Matplotlib API.
366
+ - Consider making as many arguments keyword-only as possible. See also
367
+ `API Evolution the Right Way -- Add Parameters Compatibly `__.
368
+
369
+ __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
370
+
371
+
328
372
New modules and files: installation
329
373
-----------------------------------
330
374
0 commit comments