Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecate incorrect import locations #23565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

oscargus
Copy link
Member

@oscargus oscargus commented Aug 5, 2022

PR Summary

Related to #23554

TextPath has based on the comment been imported from text earlier. AxislineStyle does not have such a comment, but is related enough to guess that there may be code importing from axislines rather than axisline_style. So to be on the safe side.

(One should possibly add that to axisartist/__init__.py and encouraging importing from there...)

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These two classes have historically sometimes been imported from incorrect
locations. This is now deprecated and `.TextPath` should be imported from
Copy link
Member

@timhoffm timhoffm Aug 6, 2022

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

@anntzer anntzer Aug 6, 2022

Choose a reason for hiding this comment

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

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...

Copy link
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

textpath was made its own module in 2009. Although it doesn't really mean that it was fullt used for its purposes.

Copy link
Member Author

Choose a reason for hiding this comment

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

See #23576 for the textpath module.

Copy link
Member Author

Choose a reason for hiding this comment

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

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

@timhoffm
Copy link
Member

I have to think about this. Let's target 3.7.

@timhoffm timhoffm added the status: needs comment/discussion needs consensus on next step label Aug 19, 2022
@timhoffm timhoffm added this to the v3.7.0 milestone Aug 19, 2022
@tacaswell tacaswell removed this from the v3.7.0 milestone Dec 16, 2022
@tacaswell
Copy link
Member

Closed in favor of #23576 which picks matplotlib.text as the canonical "correct" import location .

@tacaswell tacaswell closed this Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants