8000 Clean up base matplotlib namespace · Issue #2052 · matplotlib/matplotlib · GitHub
  • [go: up one dir, main page]

    Skip to content
    Clean up base matplotlib namespace #2052
    Open
    @efiring

    Description

    @efiring
    7099
    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.

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Type

      No type

      Projects

      No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        0