-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
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 an ImportError 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:
/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/matplotlib/font_manager.py:273:
UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Possible solutions in order of (my) preference:
- Make matplotlib an optional dependency and only import Grf (and thus matplotlib) if the user calls
Atl.plotframeset. i.e. Move the lineimport starlink.Grf as Grfinto this function. - Make matplotlib an optional dependency and only import matplotlib in the Grf functions that use it. Then
import starlink.Grf as Grfis quick, and matplotlib would only have to be imported if the user calls the functions in Grf that need it. - Make matplotlib an official dependency by adding it to setup.py, but also do (1) or (2) to avoid the above warning.
- Make matplotlib an official dependency, and continue to needlessly
import matplotlibwhenever Atl is imported.
Thanks for your consideration. :)
Metadata
Metadata
Assignees
Labels
No labels