-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matplotlib dependency not listed in setup.py #14
Comments
Sorry about that. I'll take a look. |
I've had a quick look and I think I would be inclined to fix the try:
import starlink.Grf as Grf
except ImportError:
Grf = None and then raise an exception in the |
I suppose that would solve the problem, but it seems less than ideal from an end user's perspective, since it swallows the traceback for the ImportError. If the user thought they had matplotlib installed, this wouldn't give them any feedback as to why Why not just put Remember, "A foolish consistency is..." not always the best choice. :) |
Hmmm. Yes, I tend to prefer imports at the top of code files rather than buried in the middle, but in this case, given that the failure mode is identical (you get an unexpected error some time after your program starts rather than at import time), I guess having the real error trigger inside |
Ok, I'm sleep-addled but I've put in an attempted fix in #15. |
When setting up Travis CI for GalSim, I discovered that starlink-pyast has a hidden dependency of matplotlib at the top of Grf.py. Since none of the other packages we use in GalSim require matplotlib, it didn't get installed on the Travis sandbox, and
import starlink.Atl
led to anImportError
from the matplotlib dependency.Even with matplotlib installed, it's still an annoying import, since it has to set up the font cache the first time it is imported. This takes time and adds noise to the output:
Possible solutions in order of (my) preference:
Atl.plotframeset
. i.e. Move the lineimport starlink.Grf as Grf
into this function.import starlink.Grf as Grf
is quick, and matplotlib would only have to be imported if the user calls the functions in Grf that need it.import matplotlib
whenever Atl is imported.Thanks for your consideration. :)
The text was updated successfully, but these errors were encountered: