Describe the bug
import preliz fails with matplotlib 3.11.0. The line style.core.USER_LIBRARY_PATHS.append(...) in preliz/__init__.py runs at import time and raises AttributeError. matplotlib 3.11 no longer auto-imports the matplotlib.style.core submodule, so the style.core attribute access fails (the submodule still exists, but import matplotlib.style.core is now required to reach it). This affects 0.24.0, 0.25.0, 0.26.0 (latest), and main.
To Reproduce
pip install "matplotlib==3.11.0" "preliz==0.26.0"
python -c "import preliz"
Stack trace:
File ".../preliz/__init__.py", line 31, in <module>
style.core.USER_LIBRARY_PATHS.append(_preliz_style_path)
AttributeError: module 'matplotlib.style' has no attribute 'core'
Expected behavior
import preliz works on matplotlib 3.11. A fix mirroring the one arviz-plots used (use the new top-level location, fall back to .core for old matplotlib):
if hasattr(style, "USER_LIBRARY_PATHS"):
style.USER_LIBRARY_PATHS.append(_preliz_style_path)
else:
style.core.USER_LIBRARY_PATHS.append(_preliz_style_path)
style.reload_library()
Additional context
matplotlib 3.11.0, preliz 0.26.0, Python 3.12, Linux. Found while trying to drop a matplotlib<3.11 pin in pymc-marketing, where preliz is imported lazily via pymc_extras.prior.Prior.constrain.
I reproduced it with uv in a throwaway environment:
uv run --python 3.12 --with "matplotlib==3.11.0" --with "preliz==0.26.0" python -c "import preliz"
Describe the bug
import prelizfails with matplotlib 3.11.0. The linestyle.core.USER_LIBRARY_PATHS.append(...)inpreliz/__init__.pyruns at import time and raisesAttributeError. matplotlib 3.11 no longer auto-imports thematplotlib.style.coresubmodule, so thestyle.coreattribute access fails (the submodule still exists, butimport matplotlib.style.coreis now required to reach it). This affects 0.24.0, 0.25.0, 0.26.0 (latest), andmain.To Reproduce
Stack trace:
Expected behavior
import prelizworks on matplotlib 3.11. A fix mirroring the one arviz-plots used (use the new top-level location, fall back to.corefor old matplotlib):Additional context
matplotlib 3.11.0, preliz 0.26.0, Python 3.12, Linux. Found while trying to drop a
matplotlib<3.11pin in pymc-marketing, where preliz is imported lazily viapymc_extras.prior.Prior.constrain.I reproduced it with uv in a throwaway environment: