-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
The great API cleanup #16181
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 our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also privatize ft2font, our freetype2 bindings (there's freetype-py that's installable from PyPI for third-party users, though it's not usable for us as it's ctypes-based). The tricky part here is not so much making it private, but making sure that there's no public API that leak a FT2Font (or FT2Image) object to the user. |
IMO,
|
The fontproperties API is quite clunky; even if some of it stays public we should try to make it so that most users don't have to instantiate a FontProperties explicitly, see e.g. the proposed "end-result" in #10249. |
Many things are private now, but I don't think this, as a whole, will be done for 3.3. |
This issue is rather thought to be a strategic suggestion how to evolve the existing API. I originally intended to address it in a coordinated series of PR so that we have one release with more API changes instead of continuously changing parts over various releases.
As far as I have an overview, the "many things" are mainly methods and attributes. This is only bullet point 2 (and only parts thereof) of the list above. Most is still to be done. I have no problem moving this to 3.4. |
edited the list of modules: blocking_input has been deprecated. |
Not allowed to edit, but |
Thanks, I've marked |
I checked around a bit and it seems like there are packages using (I'm sure you've had a thorough discussion, but just searching the whole of github gave quite a few examples of where |
@oscargus we had a discussion on this in the dev call and decided that |
Uh oh!
There was an error while loading. Please reload this page.
As discussed in the last call, technically public (i.e. not flagged as private with an underscore), but semantically internal API makes it hard to change anything in Matplotlib.
I propose to set a focus on reducing the API footprint for 3.3. With our current deprecation policy, we could remove that stuff from master once 3.4 is out, which should be towards the end of this year.
In particular:
Turn most parameters into keyword-only arguments. Depending on the function 0 to maybe 4 positional parameters should stay. Deprecations will be handled via
@cbook._make_keyword_only()
. This needs one of the approaches Add decorator to inherit keyword-only deprecationsΒ #14130 or Propagate signature-modifying decorators to pyplot wrappers.Β #15254 to go in so that deprecations on Axes methods are also warned about in the pyplot wrappers.Make more functions and methods private
Make more modules private. e.g. (not necessary complete):
afm
blocking_input
docstring
dviread
font_manager
fontconfig_pattern
hatch
legend_handler
mathtext
texmanager
tight_bbox
tight_layout
type1font
Mechanism to deprecate whole modules:
git mv my_module.py _my_module.py
and put this into a commit.my_module.py
with the content:and add this in a second commit.
It is important to have the move in a separate commit to maintain the history of that code. If put together in one commit, git thinks we added
_my_module.py
and modifiedmy_module.py
. Then, we could not go back in history for the moved code.[DONE] Move all the internal
cbook
functions to (a/multiple) private module(s).reads better than the current
and it does not pollute the namespace with the public package name.
Rename
camelCase
tocamel_case
(when not too public; e.g.rcParams
must stay).Internally use
import mpl
andmpl.rcParams
instead offrom matplotlib import rcParams
andrcParams
. - Partially addressed in Don't import rcParams but rather use mpl.rcParams.Β #16406.remove the obscure function
pyplot.plotting()
, which is used as a container for the pyplot docstring.The text was updated successfully, but these errors were encountered: