Skip to content

Conversation

@ZPyrolink
Copy link
Contributor

PR summary

This PR create types for the RC (Runtime Configuration)

  • Create RcKeyType
  • Create RcGroupType

These types are used on:

  • RcParams.__setitem__
  • RcParams.__getitem__
  • matplotlib.rc

PR checklist

@rcomer
Copy link
Member

rcomer commented Sep 7, 2025

Hi @ZPyrolink do you need some help getting this PR ready for review?

# Conflicts:
#	lib/matplotlib/typing.py
@ZPyrolink
Copy link
Contributor Author

Hi, sorry, I was taking a break and forgot to push my last commit and set the PR as ready for review. I only had one problem with mypy corrected with a use of RcKeyType and # type: ignore[index] (I don't know if there is another solution for this one).

@ZPyrolink ZPyrolink marked this pull request as ready for review September 7, 2025 13:51
super().__init__(default_font_prop, load_glyph_flags)
for texfont in "cal rm tt it bf sf bfit".split():
prop = mpl.rcParams['mathtext.' + texfont]
prop = mpl.rcParams['mathtext.' + texfont] # type: ignore[index]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no getter for a group so I think ignoring the error is the only solution.

Copy link
Member

@timhoffm timhoffm Sep 8, 2025

Choose a reason for hiding this comment

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

I assume mypy is complaining here. Would it help to make the list explicit?

for texfont in ["cal", "rm", "tt", "it", "bf", "sf", "bfit"]:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately mypy consider textfont as a str and the sum also as str so we have the same error

Copy link
Member

Choose a reason for hiding this comment

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

Ok in that case, ignoring is likely the simplest solution.

super().__init__(default_font_prop, load_glyph_flags)
for texfont in "cal rm tt it bf sf bfit".split():
prop = mpl.rcParams['mathtext.' + texfont]
prop = mpl.rcParams['mathtext.' + texfont] # type: ignore[index]
Copy link
Member

Choose a reason for hiding this comment

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

Ok in that case, ignoring is likely the simplest solution.

@QuLogic
Copy link
Member

QuLogic commented Oct 30, 2025

This is a bit outdated, but I'm going to merge and open a followup PR.

@QuLogic QuLogic merged commit cd3685f into matplotlib:main Oct 30, 2025
42 of 44 checks passed
@QuLogic QuLogic added this to the v3.11.0 milestone Oct 30, 2025
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.

[MNT] [TYPING]: Use of Literal

4 participants