catppuccin / catppuccin/python

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

未关闭
#129 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
156
派生
13
PR 合并指标
30 天内没有已合并 PR

描述

matplotlib 3.11.0 has [deprecated](https://github.com/matplotlib/matplotlib/blob/main/doc/api/prev_api_changes/api_changes_3.11.0/deprecations.rst) `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)
```

贡献指南

打开贡献指南

调研方向

从 catppuccin/extras/matplotlib.py 中的 _register_styles() 开始,然后在 matplotlib 3.11 下使用 import catppuccin 重现该故障。检查当前 Matplotlib 的样式注册 API,并更新此集成,使导入成功且包含的样式表能够完成注册,而不使用已移除的 read_style_directory()。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。