MetPy icon indicating copy to clipboard operation
MetPy copied to clipboard

MNT: make matplotlib an optional dependency

Open samthurston opened this issue 9 months ago • 3 comments

Applications that make use of the metpy analytical tools without the need for visualization may avoid importing matplotlib due to large import size.

In response to MetPy#2163

Description Of Changes

  • matplotlib removed from base dependencies
  • matplotlib added to "plot" optional group
  • "plot" optional group added to "extras" optional group
  • ci requirements files updated
  • installation guide updated

Checklist

  • [ x] Closes #2163
  • [x ] Fully documented

samthurston avatar Feb 11 '25 15:02 samthurston

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 11 '25 15:02 CLAassistant

Looks like re-running has fixed the doc errors. One thing to fix up is that the email on the commits doesn't appear to be associated with your GitHub account, which is why the CLA check isn't passing.

Right now, everything is passing because pytest-mpl is a fixed test requirement, which pulls in matplotlib. So for this to go forward we need a few things to be worked out on the test/CI system:

  • Version ranges for testing with matplotlib as an optional dependency
  • Only pulling in pytest-mpl when we need it
  • Marking plotting tests (or perhaps whole test plotting files) to skip when matplotlib isn't available

dopplershift avatar Feb 11 '25 21:02 dopplershift

whoops. when you forget to reset the local user.email on your work machine :)

great points. I will take a look at the tests and see what I can do there.

samthurston avatar Feb 11 '25 21:02 samthurston