Fix using matplotlib._all_deprecated, which is deprecated itself!#44
Fix using matplotlib._all_deprecated, which is deprecated itself!#44ppinard merged 2 commits intoppinard:masterfrom
matplotlib._all_deprecated, which is deprecated itself!#44Conversation
|
@ppinard, |
|
This would affect orix (and dependent packages pyxem, kikuchipy, diffsims) as well. But, I don't actually get an error when doing >>> from matplotlib import _all_deprecated, __version__
>>> print(__version__)
3.5.0 |
|
Sorry for the confusion, this is still on matplotlib main and will be release in 3.6 - since the PR was merged more than two month ago I wrongly assume, it would be in the 3.5 release. @ppinard: any idea when you could make a release fixing this issue? The fix is simple and the issue is quite annoying! Thanks! |
|
Thanks for the clarification! +1 for seeing a patch release :) |
matplotlib_scalebar/scalebar.py
Outdated
| ) | ||
|
|
||
|
|
||
| if Version(matplotlib.__version__ ) >= Version('3.5.dev'): |
There was a problem hiding this comment.
I'm just wondering whether this would be simpler to avoid the dependency to the packaging module:
_all_deprecated = getattr(matplotlib, "_all_deprecated", {})There was a problem hiding this comment.
Yes, this is better! :)
|
Thanks @ericpre for the PR and my apologies for not replying sooner. |
|
In #45 I added a new CI build that tests matplotlib-scalebar against the main branch of matplotlib. I'll merge it after this PR is completed to catch any future issues. |
| ], | ||
| packages=find_packages(), | ||
| package_data={}, | ||
| python_requires='~=3.7', |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
See matplotlib/matplotlib#21004.
from matplotlib_scalebar import scalebarwill not work with the coming matplotlib 3.5 release.