Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||