Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Clean up base matplotlib namespace #2052

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

Open
efiring opened this issue May 22, 2013 · 6 comments
Open

Clean up base matplotlib namespace #2052

efiring opened this issue May 22, 2013 · 6 comments
Labels
API: changes keep Items to be ignored by the “Stale” Github Action MEP: MEP needed

Comments

@efiring
Copy link
Member

efiring commented May 22, 2013

import matplotlib
print "\n".join(dir(matplotlib))

yields

RcParams
Verbose
__builtins__
__doc__
__file__
__name__
__package__
__path__
__version__
__version__numpy__
_create_tmp_config_dir
_deprecated_ignore_map
_deprecated_map
_get_configdir
_get_data_path
_get_data_path_cached
_get_home
_havedate
_is_writable_dir
_python24
_required
_use_error_msg
ascii
byte2str
cbook
checkdep_dvipng
checkdep_ghostscript
checkdep_inkscape
checkdep_pdftops
checkdep_ps_distiller
checkdep_tex
checkdep_usetex
checkdep_xmllint
colors
compare_versions
compat
converter
dateutil
default
defaultParams
default_test_modules
distutils
expected_version
fontconfig_pattern
found_version
get_backend
get_configdir
get_data_path
get_example_data
get_home
get_py2exe_datafiles
interactive
is_interactive
is_string_like
key
major
matplotlib_fname
minor1
minor2
numpy
os
print_function
pyparsing
rc
rcParams
rcParamsDefault
rcParamsOrig
rc_context
rc_file
rc_file_defaults
rc_params
rc_params_from_file
rcdefaults
rcsetup
re
s
shutil
subprocess
sys
tempfile
test
tk_window_focus
tmp
use
validate_backend
validate_toolbar
verbose
warnings
x

This is a mess; from the user's standpoint there are some useful things in there, but they are hard to identify among all the detritus from the startup process. And then there is the bewildering rc conglomeration. Maybe that should be treated separately.

I'm not sure whether cleaning this up requires one or more MEPs, but it probably does require some strategic thinking, so I am starting this with a MEP tag.

As a first shot, maybe all that is required is a bunch of del commands sprinkled throughout init.py. Or, every variable and module that needs to be deleted could be given a unique prefix, or added to a list, and then all could be deleted at the end.

Alternatively, leading underscores could be used aggressively so that at least when using ipython tab completion, only names that are intended to be part of the public API would appear.

@pelson
Copy link
Member

pelson commented May 23, 2013

To remove most of the rc type objects we can create a config module and simply expose the RcParams instance rcParams to matplotlib/__init__.py. We might consider adding the context manager capabilities to the RcParams class itself (with a method, rather than overriding __call__ or some other such loaded behaviour).

As you say, much of the rest looks like it could simply be deleted.

@pelson
Copy link
Member

pelson commented May 23, 2013

I don't necessarily think we need a MEP for this - thanks to @mdboom's deprecate wrapper it'd be a pretty quick PR to deprecate most of the unnecessary stuff - is feasible to get this into v1.3 and actually removed in v1.4+.

@dpsanders
Copy link

The name rcParams is terrible -- it reeks of 1970s UNIX! What about mpl_parameters, or just parameters?
Easy enough to introduce the new name and deprecate the old without breaking anything.

@tacaswell tacaswell added this to the v1.5.x milestone Aug 17, 2014
@petehuang
Copy link
Contributor

Namespace is still stuffy. For clarity, the deprecate functionality is here https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/cbook.py. You can see examples of usage in commit 8364f87

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@github-actions
Copy link

github-actions bot commented Mar 1, 2023

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Mar 1, 2023
@timhoffm timhoffm added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Mar 1, 2023
@timhoffm
Copy link
Member

timhoffm commented Mar 1, 2023

While we have made some progress, there's still things we may want to clean up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: changes keep Items to be ignored by the “Stale” Github Action MEP: MEP needed
Projects
None yet
Development

No branches or pull requests

6 participants