@@ -325,6 +325,49 @@ 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.warn_deprecated `` to deprecate whole functions.
345
+ - To warn on changes of the function signature, use the decorators
346
+ ``@cbook._delete_parameter ``, ``@cbook._rename_parameter ``, and
347
+ ``@cbook._make_keyword_only ``.
348
+
349
+ - Deprecated API may be removed two point-releases after they were deprecated.
350
+
351
+
352
+ Adding new API
353
+ --------------
354
+
355
+ Every new function, parameter and attribute that is not explicitly marked as
356
+ private (i.e., start with an underscore) become part of Matplotlib's public
357
+ API. As discussed above, changing the existing API is cumbersome. Therefore,
358
+ take particular care when adding new API:
359
+
360
+ - Mark helper functions and internal attributes as private by prefixing them
361
+ with an underscore.
362
+ - Carefully think about good names for your functions and variables.
363
+ - Try to adopt patterns and naming conventions from existing parts of the
364
+ Matplotlib API.
365
+ - Consider making as many arguments keyword-only as possible. See also
366
+ `API Evolution the Right Way -- Add Parameters Compatibly `__.
367
+
368
+ __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
369
+
370
+
328
371
New modules and files: installation
329
372
-----------------------------------
330
373
0 commit comments