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 1c1dc21

Browse filesBrowse files
committed
Coding guidelines concerning the API
1 parent b148183 commit 1c1dc21
Copy full SHA for 1c1dc21

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+43
-0
lines changed

‎doc/devel/contributing.rst

Copy file name to clipboardExpand all lines: doc/devel/contributing.rst
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,49 @@ 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.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+
328371
New modules and files: installation
329372
-----------------------------------
330373

0 commit comments

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