Skip to content

_register_styles() fails because mpl.style.core.read_style_directory() is deprecated #129

Description

@razimantv

matplotlib 3.11.0 has deprecated matplotlib.style.core, and removed read_style_directory() without replacement.

As a result, import catpuccin fails with

AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 import catppuccin

File /venv/jupyter/lib/python3.14/site-packages/catppuccin/__init__.py:96
     93 if importlib.util.find_spec("matplotlib") is not None:
     94     from catppuccin.extras.matplotlib import _register_colormap_list, _register_styles
---> 96     _register_styles()
     97     _register_colormap_list()

File /venv/jupyter/lib/python3.14/site-packages/catppuccin/extras/matplotlib.py:87, in _register_styles()
     85 def _register_styles() -> None:
     86     """Register the included stylesheets in the mpl style library."""
---> 87     catppuccin_stylesheets = mpl.style.core.read_style_directory(  # type: ignore [attr-defined]
     88         CATPPUCCIN_STYLE_DIRECTORY
     89     )
     90     mpl.style.core.update_nested_dict(mpl.style.library, catppuccin_stylesheets)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions