Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb85c16

Browse filesBrowse files
authored
Merge pull request #13500 from meeseeksmachine/auto-backport-of-pr-12763-on-v3.1.x
Backport PR #12763 on branch v3.1.x (Remove deprecated rcParams.)
2 parents 70618de + e743880 commit fb85c16
Copy full SHA for fb85c16

File tree

Expand file treeCollapse file tree

5 files changed

+29
-39
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+29
-39
lines changed
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Removed rcParams
2+
````````````````
3+
4+
The following deprecated rcParams are removed:
5+
6+
- ``text.dvipnghack``,
7+
- ``nbagg.transparent`` (use :rc:`figure.facecolor` instead),
8+
- ``plugins.directory``,
9+
- ``axes.hold``,
10+
- ``backend.qt4`` and ``backend.qt5`` (set the :envvar:`QT_API` environment
11+
variable instead).
12+
13+
The associated validator functions ``rcsetup.validate_qt4`` and
14+
``validate_qt5`` are deprecated.

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+1-13Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -695,19 +695,13 @@ def gen_candidates():
695695
# rcParams deprecated; some can manually be mapped to another key.
696696
# Values are tuples of (version, new_name_or_None).
697697
_deprecated_ignore_map = {
698-
'text.dvipnghack': ('2.1', None),
699-
'nbagg.transparent': ('2.2', 'figure.facecolor'),
700-
'plugins.directory': ('2.2', None),
701698
'pgf.debug': ('3.0', None),
702699
}
703700

704701
# rcParams deprecated; can use None to suppress warnings; remain actually
705702
# listed in the rcParams (not included in _all_deprecated).
706703
# Values are tuples of (version,)
707704
_deprecated_remain_as_none = {
708-
'axes.hold': ('2.1',),
709-
'backend.qt4': ('2.2',),
710-
'backend.qt5': ('2.2',),
711705
'text.latex.unicode': ('3.0',),
712706
}
713707

@@ -771,14 +765,8 @@ def __setitem__(self, key, val):
771765
val = alt_val(val)
772766
elif key in _deprecated_remain_as_none and val is not None:
773767
version, = _deprecated_remain_as_none[key]
774-
addendum = ''
775-
if key.startswith('backend'):
776-
addendum = (
777-
"In order to force the use of a specific Qt binding, "
778-
"either import that binding first, or set the QT_API "
779-
"environment variable.")
780768
cbook.warn_deprecated(
781-
version, name=key, obj_type="rcparam", addendum=addendum)
769+
version, name=key, obj_type="rcparam")
782770
elif key in _deprecated_ignore_map:
783771
version, alt_key = _deprecated_ignore_map[key]
784772
cbook.warn_deprecated(

‎lib/matplotlib/backends/qt_compat.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/qt_compat.py
+12-19Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
The selection logic is as follows:
55
- if any of PyQt5, PySide2, PyQt4 or PySide have already been imported
66
(checked in that order), use it;
7-
- otherwise, if the QT_API environment variable (used by Enthought) is
8-
set, use it to determine which binding to use (but do not change the
9-
backend based on it; i.e. if the Qt4Agg backend is requested but QT_API
10-
is set to "pyqt5", then actually use Qt4 with the binding specified by
11-
``rcParams["backend.qt4"]``;
7+
- otherwise, if the QT_API environment variable (used by Enthought) is set, use
8+
it to determine which binding to use (but do not change the backend based on
9+
it; i.e. if the Qt5Agg backend is requested but QT_API is set to "pyqt4",
10+
then actually use Qt5 with PyQt5 or PySide2 (whichever can be imported);
1211
- otherwise, use whatever the rcParams indicate.
1312
"""
1413

@@ -33,31 +32,25 @@
3332
# First, check if anything is already imported.
3433
if "PyQt5" in sys.modules:
3534
QT_API = QT_API_PYQT5
36-
dict.__setitem__(rcParams, "backend.qt5", QT_API)
3735
elif "PySide2" in sys.modules:
3836
QT_API = QT_API_PYSIDE2
39-
dict.__setitem__(rcParams, "backend.qt5", QT_API)
4037
elif "PyQt4" in sys.modules:
4138
QT_API = QT_API_PYQTv2
42-
dict.__setitem__(rcParams, "backend.qt4", QT_API)
4339
elif "PySide" in sys.modules:
4440
QT_API = QT_API_PYSIDE
45-
dict.__setitem__(rcParams, "backend.qt4", QT_API)
4641
# Otherwise, check the QT_API environment variable (from Enthought). This can
4742
# only override the binding, not the backend (in other words, we check that the
4843
# requested backend actually matches).
4944
elif rcParams["backend"] in ["Qt5Agg", "Qt5Cairo"]:
50-
if QT_API_ENV == "pyqt5":
51-
dict.__setitem__(rcParams, "backend.qt5", QT_API_PYQT5)
52-
elif QT_API_ENV == "pyside2":
53-
dict.__setitem__(rcParams, "backend.qt5", QT_API_PYSIDE2)
54-
QT_API = dict.__getitem__(rcParams, "backend.qt5")
45+
if QT_API_ENV in ["pyqt5", "pyside2"]:
46+
QT_API = _ETS[QT_API_ENV]
47+
else:
48+
QT_API = None
5549
elif rcParams["backend"] in ["Qt4Agg", "Qt4Cairo"]:
56-
if QT_API_ENV == "pyqt4":
57-
dict.__setitem__(rcParams, "backend.qt4", QT_API_PYQTv2)
58-
elif QT_API_ENV == "pyside":
59-
dict.__setitem__(rcParams, "backend.qt4", QT_API_PYSIDE)
60-
QT_API = dict.__getitem__(rcParams, "backend.qt4")
50+
if QT_API_ENV in ["pyqt4", "pyside"]:
51+
QT_API = _ETS[QT_API_ENV]
52+
else:
53+
QT_API = None
6154
# A non-Qt backend was selected but we still got there (possible, e.g., when
6255
# fully manually embedding Matplotlib in a Qt app without using pyplot).
6356
else:

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,14 @@ def validate_backend(s):
267267
return backend
268268

269269

270+
@cbook.deprecated("3.1")
270271
def validate_qt4(s):
271272
if s is None:
272273
return None
273274
return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s)
274275

275276

277+
@cbook.deprecated("3.1")
276278
def validate_qt5(s):
277279
if s is None:
278280
return None
@@ -993,13 +995,10 @@ def _validate_linestyle(ls):
993995
defaultParams = {
994996
'backend': [_auto_backend_sentinel, validate_backend],
995997
'backend_fallback': [True, validate_bool],
996-
'backend.qt4': [None, validate_qt4],
997-
'backend.qt5': [None, validate_qt5],
998998
'webagg.port': [8988, validate_int],
999999
'webagg.address': ['127.0.0.1', validate_webagg_address],
10001000
'webagg.open_in_browser': [True, validate_bool],
10011001
'webagg.port_retries': [50, validate_int],
1002-
'nbagg.transparent': [True, validate_bool],
10031002
'toolbar': ['toolbar2', validate_toolbar],
10041003
'datapath': [None, validate_path_exists], # handled by
10051004
# _get_data_path_cached
@@ -1129,7 +1128,6 @@ def _validate_linestyle(ls):
11291128
'text.latex.unicode': [True, validate_bool],
11301129
'text.latex.preamble': ['', _validate_tex_preamble],
11311130
'text.latex.preview': [False, validate_bool],
1132-
'text.dvipnghack': [None, validate_bool_maybe_none],
11331131
'text.hinting': ['auto', validate_hinting],
11341132
'text.hinting_factor': [8, validate_int],
11351133
'text.antialiased': [True, validate_bool],
@@ -1412,8 +1410,6 @@ def _validate_linestyle(ls):
14121410

14131411
# set this when you want to generate hardcopy docstring
14141412
'docstring.hardcopy': [False, validate_bool],
1415-
# where plugin directory is locate
1416-
'plugins.directory': ['.matplotlib_plugins', validate_string],
14171413

14181414
'path.simplify': [True, validate_bool],
14191415
'path.simplify_threshold': [1.0 / 9.0, ValidateInterval(0.0, 1.0)],

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def test_Bug_2543():
124124
_copy = mpl.rcParams.copy()
125125
for key in _copy:
126126
mpl.rcParams[key] = _copy[key]
127-
mpl.rcParams['text.dvipnghack'] = None
128127
with mpl.rc_context():
129128
_deep_copy = copy.deepcopy(mpl.rcParams)
130129
# real test is that this does not raise

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.