has2k1 / mizani

A scales package for python
https://mizani.readthedocs.io
BSD 3-Clause "New" or "Revised" License
49 stars 14 forks source link

Error when loading dev version: No module named 'mizani.external' #28

Closed wch closed 1 year ago

wch commented 1 year ago

As of a475dc5e3e5579957ec2f9bc952e24b13bb60f53, import plotnine fails with the error No module named 'mizani.external'. The problem seems to be in loading mizani.palettes:

>>> import plotnine
Traceback (most recent call last):
  File "<exec>", line 1, in <module>
  File "/lib/python3.10/site-packages/plotnine/__init__.py", line 4, in <module>
    from .facets import *  # noqa: F401,F403,E261
  File "/lib/python3.10/site-packages/plotnine/facets/__init__.py", line 4, in <module>
    from .facet_grid import facet_grid
  File "/lib/python3.10/site-packages/plotnine/facets/facet_grid.py", line 9, in <module>
    from .facet import (
  File "/lib/python3.10/site-packages/plotnine/facets/facet.py", line 15, in <module>
    from ..scales.scales import Scales
  File "/lib/python3.10/site-packages/plotnine/scales/__init__.py", line 5, in <module>
    from .limits import expand_limits, lims, xlim, ylim
  File "/lib/python3.10/site-packages/plotnine/scales/limits.py", line 7, in <module>
    from ..geoms import geom_blank
  File "/lib/python3.10/site-packages/plotnine/geoms/__init__.py", line 13, in <module>
    from .geom_boxplot import geom_boxplot
  File "/lib/python3.10/site-packages/plotnine/geoms/geom_boxplot.py", line 24, in <module>
    from .geom_point import geom_point
  File "/lib/python3.10/site-packages/plotnine/geoms/geom_point.py", line 9, in <module>
    from ..scales.scale_shape import FILLED_SHAPES
  File "/lib/python3.10/site-packages/plotnine/scales/scale_shape.py", line 3, in <module>
    from mizani.palettes import manual_pal
  File "/lib/python3.10/site-packages/mizani/palettes.py", line 26, in <module>
    from .external import crayon_rgb, husl, xkcd_rgb
ModuleNotFoundError: No module named 'mizani.external'

I believe the problem is caused by this:

https://github.com/has2k1/mizani/blob/a475dc5e3e5579957ec2f9bc952e24b13bb60f53/pyproject.toml#L95-L97

has2k1 commented 1 year ago

I could not reproduce it with

pip install git+https://github.com/has2k1/mizani.git@main
python -c "import mizani.external"

The exclude line is configuration for a linting tool. I have made some changes, you can try them out in the main branch.