Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit db06a34

Browse filesBrowse files
authored
Merge pull request matplotlib#14555 from timhoffm/contributing-api
Coding guidelines concerning the API
2 parents 896fb81 + 2aba578 commit db06a34
Copy full SHA for db06a34

File tree

Expand file treeCollapse file tree

1 file changed

+44
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+44
-0
lines changed

‎doc/devel/contributing.rst

Copy file name to clipboardExpand all lines: doc/devel/contributing.rst
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,50 @@ and articles or link to it from your website!
325325
Coding guidelines
326326
=================
327327

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+
328372
New modules and files: installation
329373
-----------------------------------
330374

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.