Closed hadfieldnz closed 1 year ago
Sorry for missing line breaks in the code snippets above. I didn't notice the Preview pane so didn't preview my Markdown.
Hi! Sorry for my delay, been traveling.
You're right that the import statement isn't currently correct. Earlier on, plots
was included in the main install, but some people preferred that it be kept separate so as to not require more packages than strictly necessary. So, plots
has been a bit separate. I did try to have multiple ways to install cmocean on conda-forge, but I wasn't able to get it to work and gave up as I recall. Here is my current thinking about your suggestions, in backward order:
Modifying the plot_gallery demonstration code on the front page to use the "from cmocean import plots" idiom. (This is widely used by other packages.)
What about just adding "plots" to the end of import cmocean:
import cmocean.plots
cmocean.plots.plot_gallery()
Making colorspacious a dependency of cmocean on conda-forge. And maybe also viscm
I would like to find more info on this. @tacaswell or @ocefpaf do you have any advice about how best to approach this? Do you think it's too much to have viscm and colorspacious required when many people won't want to use them? Is it reasonable to have options built into the conda-forge build (which was my original intent)? @ocefpaf you were nearby when I was trying to get this to work last year at SciPy and it seems like it is not trivial.
The "pip install cmocean[plots]" trick does not carry over to conda, i.e. "conda install cmocean[plots]" has exactly the same effect as "conda install cmocean": it installs cmocean only.
conda does not have the concept of optional dependencies. We can either make a bulkier package with all the optional dependencies or the user should install them separately.
Making colorspacious a dependency of cmocean on conda-forge. And maybe also viscm
Looks like them are light enough to be a core dependency.
@ocefpaf you were nearby when I was trying to get this to work last year at SciPy and it seems like it is not trivial.
I don't remember but we can try and see how hard it is.
This looks promising!
Sorry I neglected this for so long! I'm trying to get cmocean
modernized to now.
conda does not have the concept of optional dependencies
@ocefpaf isn't that what you did in https://github.com/conda-forge/cmocean-feedstock/pull/14?
@ocefpaf isn't that what you did in conda-forge/cmocean-feedstock#14?
I think so. At least it is what the GitHub breadcrumbs tells me :-P
I think colorspacious
is now just installed with cmocean
through conda-forge.
@hadfieldnz I'm going to close this now since I think you can get the behavior you want with
import cmocean.plots
cmocean.plots.plot_gallery()
You can reopen it for further discussion.
I have cmocean 2.0 installed in a python 3.7 environment under Miniconda.
The "pip install cmocean[plots]" trick does not carry over to conda, i.e. "conda install cmocean[plots]" has exactly the same effect as "conda install cmocean": it installs cmocean only.
The main web site (https://matplotlib.org/cmocean/) suggests running the plot gallery with
import cmocean cmocean.plots.plot_gallery()
This does not work for me. However I can run the plot_gallery function by first installing colorspacious and then running this code:
from cmocean import plots as cmplots cmplots.plot_gallery()
I therefore suggest: