From 7e043ab9776ab4b23761f21fb386bff191f2cc4a Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Thu, 14 Oct 2021 21:11:27 +0100 Subject: [PATCH 1/2] Fix using `matplotlib._all_deprecated`, which has been removed in matplotlib 3.5 --- matplotlib_scalebar/scalebar.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/matplotlib_scalebar/scalebar.py b/matplotlib_scalebar/scalebar.py index d4c7917..7e388ef 100644 --- a/matplotlib_scalebar/scalebar.py +++ b/matplotlib_scalebar/scalebar.py @@ -39,6 +39,7 @@ # Standard library modules. import bisect import warnings +from packaging.version import Version # Third party modules. import matplotlib @@ -111,11 +112,17 @@ def _validate_legend_loc(loc): } ) + +if Version(matplotlib.__version__ ) >= Version('3.5.dev'): + _all_deprecated = {} +else: + _all_deprecated = matplotlib._all_deprecated + # Recreate the validate function matplotlib.rcParams.validate = dict( (key, converter) for key, (default, converter) in defaultParams.items() - if key not in matplotlib._all_deprecated + if key not in _all_deprecated ) # Dimension lookup From d7a1dfbc8ac6a551676a3ccf76df59c66d67928c Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sun, 21 Nov 2021 20:27:12 +0000 Subject: [PATCH 2/2] Simplify getting `matplotlib._all_deprecated` --- matplotlib_scalebar/scalebar.py | 7 ++----- setup.py | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/matplotlib_scalebar/scalebar.py b/matplotlib_scalebar/scalebar.py index 7e388ef..f89eb04 100644 --- a/matplotlib_scalebar/scalebar.py +++ b/matplotlib_scalebar/scalebar.py @@ -39,7 +39,6 @@ # Standard library modules. import bisect import warnings -from packaging.version import Version # Third party modules. import matplotlib @@ -113,10 +112,8 @@ def _validate_legend_loc(loc): ) -if Version(matplotlib.__version__ ) >= Version('3.5.dev'): - _all_deprecated = {} -else: - _all_deprecated = matplotlib._all_deprecated +_all_deprecated = getattr(matplotlib, "_all_deprecated", {}) + # Recreate the validate function matplotlib.rcParams.validate = dict( diff --git a/setup.py b/setup.py index 450c0a4..b188976 100644 --- a/setup.py +++ b/setup.py @@ -35,10 +35,15 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Scientific/Engineering :: Visualization", ], packages=find_packages(), package_data={}, + python_requires='~=3.7', install_requires=["matplotlib"], zip_safe=True, cmdclass=versioneer.get_cmdclass(),