Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion matplotlib_scalebar/scalebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ def _validate_legend_loc(loc):
}
)


_all_deprecated = getattr(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
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is necessary in this case, because matplotlib 3.5 dropped support for python 3.6, but using getattr(matplotlib, "_all_deprecated", {}) should require python 3.7 (https://www.python.org/dev/peps/pep-0562). I haven't checked if this is correct but in any case, I think that it doesn't hurt to be explicit on the minimum python version supported!

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually getattr was there since Python 2.x (https://docs.python.org/2.7/library/functions.html#getattr) but there is little point that matplotlib-scalebar supports Python versions that matplotlib doesn't! Thanks.

install_requires=["matplotlib"],
zip_safe=True,
cmdclass=versioneer.get_cmdclass(),
Expand Down