8000 Update type hints for font manager and extension by QuLogic · Pull Request #26403 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Update type hints for font manager and extension #26403

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

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Jul 28, 2023

PR summary

Several setters allow None, but are normalized so that the getter is not.

For ttf, the FontEntry weight may be an int instead of a str.

PR checklist

@QuLogic
Copy link
Member Author
QuLogic commented Jul 28, 2023

I'm confused why I'm getting:

lib/matplotlib/ft2font.pyi:5: error: Module "typing_extensions" has no attribute "Buffer"  [attr-defined]

because docs say that is in 4.6, for which I've bumped the requirements, and we've ended up with 4.7.1 installed. Maybe we need a newer mypy too?

@ksunden
Copy link
Member
ksunden commented Jul 28, 2023

Mypy uses a vendored version of typeshed, which was synced to include Buffer here

So yes, I think a newer version of mypy is needed for this (>=1.4.0)

Upgrading that will require ignoring the staticmethod problem that we pinned mypy for (which hasn't seen much traction upstream, though somebody else recently opened a similar issue, sooo)

@QuLogic
Copy link
Member Author
QuLogic commented Jul 28, 2023

Hmm, well we didn't have Buffer on there before; maybe we can leave that out until mypy is fixed.

@QuLogic QuLogic marked this pull request as ready for review July 28, 2023 03:03
@tacaswell tacaswell added this to the v3.8.0 milestone Jul 28, 2023
@tacaswell tacaswell merged commit ccad5ef into matplotlib:main Aug 2, 2023
@QuLogic QuLogic deleted the font-typing branch August 2, 2023 19:49
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.

3 participants
0