Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Soft deprecate the textpath module (import from text instead)#23576

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:mainfromoscargus:softdeprecatetextpath
Dec 21, 2022

Conversation

oscargus
Copy link
Member

The textpath module was created in 2009, but the status has
been a bit vague with many examples and exisiting code found
on the internet importing from text instead.

In this PR everything is changed to point at text, although textpath
is still available for backwards compatibility.

PR Summary

See discussion in#23565 (comment)

Also a bit of cleanup of related documentation.

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

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

@tacaswell
Copy link
Member

I'm 50/50 on this. If anything I think the error is the places than are importing transitively throughmatplotilb.text not the other way around....

@oscargus
Copy link
MemberAuthor

There is also#23565 where the consensus seems to be that this is the correct solution. Somehow, one of them should be...

@tacaswell
Copy link
Member

Re-reading the conversation here and in#23565 , the consensus seems to be in favor of this path (I'm still a coin flip), so lets go with this for 3.7.

@ksunden
Copy link
Member

Should we add a__all__ totext.py to make it even more explicit thatTextPath is an exported public api?

The potential downside of course being that things we don't consider "public" would no longer be imported if someone didfrom matplotlib.text import * ...

That said, this mostly applies to transitive imports since anything defined here would be exported and_methods are explicitly private. so this would only really affect people doing things like usingArtist ornp from the* import oftext, which is not intended usage)

The other one that is closely related enough that I'd consider it reasonable to think "that is in text" would beFontProperties, Everything else is pretty clearly not "text" and so should not be expected to be imported viampl.text I would expect.

@timhoffm
Copy link
Member

The overall strategiy is good.

Should we add a__all__ totext.py to make it even more explicit thatTextPath is an exported public api?

Unfortunately. specification of public API does not have proper language support in python.__all__ is only a band aid and not really suited for the task. I would refrain from this.

Another issue is thatTextPath will not disguise its origin. The fully qualified name will staymatplotlib.textpath.TextPath however much we document and__all__. Well, we could monkey patch that, but that's not a good idea either. It may be reasonable to bite the bullet and actually move the code totext. Then, reverse the import andfrom matplotlib.text import TextPath intextpath for backward compatibility. But that can be done later.

The textpath module was created in 2009, but the status hasbeen a bit vague with many examples and exisiting code foundon the internet importing from text instead.In this PR everything is changed to point at text, although textpathis still available for backwards compatibility.
@oscargus
Copy link
MemberAuthor

Another issue is thatTextPath will not disguise its origin.

As long as we use and document it consistently it will be better than the current situation. I do not think that we actually need to move it, but it is confusing if it sometimes is imported from text and sometimes from textpath.

@QuLogicQuLogic merged commit0425a7f intomatplotlib:mainDec 21, 2022
@oscargusoscargus deleted the softdeprecatetextpath branchDecember 21, 2022 23:22
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

5 participants
@oscargus@tacaswell@ksunden@timhoffm@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp