From 0cf039c1e8fb9b310cb1a02e04fc6f9ae02b52f0 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 8 Dec 2019 16:46:40 +0100 Subject: [PATCH] Deprecate rcParams["datapath"] in favor of mpl.get_data_path(). The rcParam cannot be meaningfully set by the end user from their matplotlibrc or Python code. --- doc/api/next_api_changes/removals.rst | 1 + lib/matplotlib/__init__.py | 30 +++------------------------ 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index 24da01c0e715..2c3a5d950fc2 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -179,6 +179,7 @@ rcParams - The ``pgf.debug``, ``verbose.fileo`` and ``verbose.verbose.level`` rcParams, which had no effect, have been removed. - Support for setting :rc:`mathtext.default` to "circled" has been removed. +- The ``datapath`` rcParam has been removed. Use `.get_data_path` instead. Environment variables ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index b9f4cafc6c7e..aa1e410d8cdb 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -509,29 +509,8 @@ def get_cachedir(): @_logged_cached('matplotlib data path: %s') -def get_data_path(*, _from_rc=None): +def get_data_path(): """Return the path to Matplotlib data.""" - if _from_rc is not None: - cbook.warn_deprecated( - "3.2", - message=("Setting the datapath via matplotlibrc is deprecated " - "%(since)s and will be removed in %(removal)s."), - removal='3.3') - path = Path(_from_rc) - if path.is_dir(): - defaultParams['datapath'][0] = str(path) - return str(path) - else: - warnings.warn(f"You passed datapath: {_from_rc!r} in your " - f"matplotribrc file ({matplotlib_fname()}). " - "However this path does not exist, falling back " - "to standard paths.") - - return _get_data_path() - - -@_logged_cached('(private) matplotlib data path: %s') -def _get_data_path(): path = Path(__file__).with_name("mpl-data") if path.is_dir(): defaultParams['datapath'][0] = str(path) @@ -594,7 +573,7 @@ def gen_candidates(): yield matplotlibrc yield os.path.join(matplotlibrc, 'matplotlibrc') yield os.path.join(get_configdir(), 'matplotlibrc') - yield os.path.join(_get_data_path(), 'matplotlibrc') + yield os.path.join(get_data_path(), 'matplotlibrc') for fname in gen_candidates(): if os.path.exists(fname) and not os.path.isdir(fname): @@ -861,10 +840,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True): config.update(config_from_file) with cbook._suppress_matplotlib_deprecation_warning(): - if config['datapath'] is None: - config['datapath'] = _get_data_path() - else: - config['datapath'] = get_data_path(_from_rc=config['datapath']) + config['datapath'] = get_data_path() if "".join(config['text.latex.preamble']): _log.info(""" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy