Skip to content

Prepare to turn matplotlib.style into a plain module. #30163

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 11, 2025

Having matplotlib.style be a package with the entire implementation in matplotlib.style.core is a bit overkill, and also makes it slightly awkward that USER_LIBRARY_PATHS is effectively a public API (clearly intended as so, per the comment, even though we may do it differently nowadays...) but only available in matplotlib.style.core, whereas everything else is re-exported by matplotlib.style.

Prepare to flatten the implementation by deprecating matplotlib.style.core and reexporting USER_LIBRARY_PATHS in matplotlib.style. Once the deprecation elapses, we'll be able to move the implementation into a plain matplotlib/style.py module.

PR summary

PR checklist

@anntzer anntzer force-pushed the ms branch 3 times, most recently from 6dbfc13 to 9d16b89 Compare June 11, 2025 18:49
@tacaswell tacaswell added this to the v3.11.0 milestone Jun 12, 2025
@anntzer
Copy link
Contributor Author

anntzer commented Jun 12, 2025

mypy seems unhappy

lib/matplotlib/style/__init__.py:241: error: Need type annotation for "library" (hint: "library: dict[<type>, <type>] = ...")  [var-annotated]
lib/matplotlib/style/__init__.py:242: error: Need type annotation for "available" (hint: "available: list[<type>] = ...")  [var-annotated]

even though these are clearly listed in __init__.pyi, do you know why/how to fix this?

@tacaswell
Copy link
Member

I suspect it is the issue is that it is missing from the meson.build.

@anntzer
Copy link
Contributor Author

anntzer commented Jun 13, 2025

Ah, thanks for pointing it out. Dropping style/meson.build is probably another good reason for the change :)

Having matplotlib.style be a package with the entire implementation in
matplotlib.style.core is a bit overkill, and also makes it slightly
awkward that USER_LIBRARY_PATHS is effectively a public API (clearly
intended as so, per the comment, even though we may do it differently
nowadays...) but only available in matplotlib.style.core, whereas
everything else is re-exported by matplotlib.style.

Prepare to flatten the implementation by deprecating
matplotlib.style.core and reexporting USER_LIBRARY_PATHS in
matplotlib.style.  Once the deprecation elapses, we'll be able to
move the implementation into a plain matplotlib/style.py module.
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.

2 participants