holoviz / colorcet

A set of useful perceptually uniform colormaps for plotting scientific data
http://colorcet.holoviz.org
Other
673 stars 52 forks source link

Depend on appropriate pyct extras #76

Closed musicinmybrain closed 2 years ago

musicinmybrain commented 2 years ago

Change the install_requires on pyct to pyct[cmd], and the build dependencies to pyct[build,cmd], in order to ensure that the appropriate optional/extra dependencies of pyct are installed.

This fixes the following problem:

$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install colorcet
Collecting colorcet
  Using cached colorcet-2.0.6-py2.py3-none-any.whl (1.6 MB)
Collecting pyct>=0.4.4
  Using cached pyct-0.4.8-py2.py3-none-any.whl (15 kB)
Collecting param>=1.7.0
  Using cached param-1.12.0-py2.py3-none-any.whl (85 kB)
Installing collected packages: param, pyct, colorcet
Successfully installed colorcet-2.0.6 param-1.12.0 pyct-0.4.8
(_e) $ colorcet --help
Traceback (most recent call last):
  File "[…]/_e/lib64/python3.10/site-packages/colorcet/__main__.py", line 3, in main
    import pyct.cmd
  File "[…]/_e/lib64/python3.10/site-packages/pyct/cmd.py", line 81, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "[…]/_e/bin/colorcet", line 8, in <module>
    sys.exit(main())
  File "[…]/_e/lib64/python3.10/site-packages/colorcet/__main__.py", line 6, in main
    from . import _missing_cmd
ImportError: cannot import name '_missing_cmd' from 'colorcet' (…/_e/lib64/python3.10/site-packages/colorcet/__init__.py)

(Well—it fixes the ModuleNotFoundError. The nonexistence of _missing_cmd is a separate issue.)

musicinmybrain commented 2 years ago

Thinking about this some more, perhaps it would be better instead to add a cmd extra to this package, and tie the extra dependencies to that, since most users won’t need the colorcet command.

jbednar commented 2 years ago

Hmm. Yes, maybe we should make the colorcet shell command optional in its entirety; it's certainly not something that most users would need.

musicinmybrain commented 2 years ago

The change to pyct[build] in pyproject.toml and in the definition of the build extra is probably still technically correct. If you like, I can make a PR just for that. Right now, it doesn’t really matter, because the build extra of pyct just brings in setuptools and param >=1.7.0, which are both direct dependencies of colorcet anyway.