TYP: Improve type coverage of matplotlib.text - #32139
Conversation
timhoffm
left a comment
There was a problem hiding this comment.
Switching to object is the right thing to do.
| parse_math: bool | None = ..., | ||
| antialiased: bool | None = ..., | ||
| **kwargs | ||
| **kwargs: Any |
There was a problem hiding this comment.
The supported kwargs are actually known. See the docs https://matplotlib.org/stable/api/text_api.html#matplotlib.text.Text
We could be more specific and define them in a TextProperties TypedDict and Unpack[TextProperties] here.
There was a problem hiding this comment.
@timhoffm thanks for the review, this indirectly answerd my question from other PR.
The supported kwargs are actually known. See the docs https://matplotlib.org/stable/api/text_api.html#matplotlib.text.Text
We could be more specific and define them in a TextProperties TypedDict and Unpack[TextProperties] here.
make sense, i'll update with this and my other PRs too
There was a problem hiding this comment.
Let's do this separately, because it's a dedicated and complex enough effort: Basically what we want is a Typed Dict for the artist properties. Artist properties are essentially the things you can set_[propname] on any object. These are in many cases the accepted and passed though by kwargs, and therefore artist property Typed Dicts make sense.
You'll want to create a Typed Dict hierarchy following the Artist hierarchy, i.e. TextProperties inheriting from ArtistProperties.
I'll merge this PR as, and you can do a follow-up with the typed dicts.
There was a problem hiding this comment.
Let's do this separately, because it's a dedicated and complex enough effort: Basically what we want is a Typed Dict for the artist properties. Artist properties are essentially the things you can set_[propname] on any object. These are in many cases the accepted and passed though by kwargs, and therefore artist property Typed Dicts make sense.
thanks for explanation, make sense.
Would it be fine if I open one issue for type annotation, which basically keep track, and maybe i can ask or discuss, any point there.
I'll merge this PR as, and you can do a follow-up with the typed dicts.
also, thanks for merging this, i've two more opened PR, those are also simple with small changes, please have a look when you get chance and share your thoughts.
PR summary
matplotlib.textTowards #32157
AI Disclosure
No AI (except suggestion to use
objectintext)PR quality check