Skip to content

Matplotlib dependency not listed in setup.py #14

@rmjarvis

Description

@rmjarvis

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:

  1. Make matplotlib an optional dependency and only import Grf (and thus matplotlib) if the user calls Atl.plotframeset. i.e. Move the line import starlink.Grf as Grf into this function.
  2. Make matplotlib an optional dependency and only import matplotlib in the Grf functions that use it. Then 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.
  3. Make matplotlib an official dependency by adding it to setup.py, but also do (1) or (2) to avoid the above warning.
  4. Make matplotlib an official dependency, and continue to needlessly import matplotlib whenever Atl is imported.

Thanks for your consideration. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions