Deprecate incorrect import locations#23565
Conversation
a950ea5 to
9fced56
Compare
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| These two classes have historically sometimes been imported from incorrect | ||
| locations. This is now deprecated and `.TextPath` should be imported from |
There was a problem hiding this comment.
I'm not sure we should do this. If we deprecate we break a lot of user code eventually.
https://github.com/search?q=%22from+matplotlib.textpath+import+TextPath%22&type=code
textpath -> 825 hits
https://github.com/search?q=%22from+matplotlib.text+import+TextPath%22&type=code
text -> 1783 hits
Could do a pending deprecation.
I also don't know which way I would deprecate. Sure, TextPath is in TextPath (alongside with TextToPath). But is it really necessary to have that many modules as API surface. I can see an argument that these are text-like enough to be accessed via the text module. - Which would long-term mean making textpath private, or moving the contents to text directly.
There's also the alternative to just not bother if we have no clearly better solution.
There was a problem hiding this comment.
Agreed that if we really want to pick one module (which is not clear), I'd rather make text the "official" one.
Perhaps the same argument applies to axisline_style, in fact...
There was a problem hiding this comment.
OK! But then maybe we should at least make sure that TextPath is documented as being in text and not in textpath? https://matplotlib.org/devdocs/api/textpath_api.html
There was a problem hiding this comment.
textpath was made its own module in 2009. Although it doesn't really mean that it was fullt used for its purposes.
There was a problem hiding this comment.
As a preparation for the dev call:
textpath 25 hits (5 matplotlib, 8 Visualization book)
https://grep.app/search?q=from%20matplotlib.textpath%20import%20TextPath
text 13 hits (3 matplotlib, 3 matplotlib-cn, 4 Visualization book)
https://grep.app/search?q=from%20matplotlib.text%20import%20TextPath
|
I have to think about this. Let's target 3.7. |
|
Closed in favor of #23576 which picks |
PR Summary
Related to #23554
TextPathhas based on the comment been imported fromtextearlier.AxislineStyledoes not have such a comment, but is related enough to guess that there may be code importing fromaxislinesrather thanaxisline_style. So to be on the safe side.(One should possibly add that to
axisartist/__init__.pyand encouraging importing from there...)PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).