Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

In contributing.rst, encourage kwonly args and minimizing public APIs.#14545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
anntzer wants to merge1 commit intomatplotlib:masterfromanntzer:kwonly
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletionsdoc/devel/contributing.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -349,6 +349,23 @@ C/C++ extensions
docstrings, and the Numpydoc format is well understood in the
scientific Python community.

New public APIs
---------------

Public APIs added to Matplotlib are bound by backwards compatibility, and
therefore cumbersome to change. Therefore, when adding new functionality, try
to add as little public API as possible. In particular, make sure that helper
methods and internal attributes are private (i.e., start with an underscore).
Remember that any non-private method can be directly called by the end user,
and any non-private attribute can be directly set!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd probably leave out this sentence. It is extraneous and doesn't really explain why this is a "bad thing" (it can also confuse some contributors because they'll notice that they can do exactly the same thing with private methods and attributes).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not particularly in love with the wording here, but I do want to stress that point extremely strongly: if an attribute is public, the implementation should be robust against the end user modifying it; otherwise, make it private, or hide it behind a getter or a property.
If you have a better wording I'm all ears :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Or add a "And therefore once we have released that API the behavior, arguments, and names can not be changed without going through a multi-version deprecation process." ?


In order to make it easier to evolve APIs, consider making as many arguments
keyword-only as possible.

.. seealso:: `API Evolution the Right Way -- Add Parameters Compatibly`__

__ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters

.. _keyword-argument-processing:

Keyword argument processing
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp