-
Notifications
You must be signed in to change notification settings - Fork 45
Description
I think it'd be worth exploring using something like packaging to give us better compatibility across Matplotlib versions and in doing so make it clear to the reader/user what is being used when and why.
Right now we have a lot of places where the example code only works for a specific narrow range of package versions. Matplotlib in particular has made a lot of API changes we've needed to adapt to and at the moment we're not really tracking this well or doing a great job of making it clear what versions we're compatible with.
Using packaging we could check for a version then provide options for what code to use depending upon the version. A lot of Python packages use this approach. I'm a little hesitant to use it in an example gallery, but I think in our case with so many dependencies and a community where folks are looking for compatibility across a lot of packages and often are slow to update their environments it might be worth it.
Pros:
- Allows us to have examples that are compatible with a wider range of package versions
- This includes allowing us to respond to pending upstream changes without breaking compatibility with current versions (see Upstream CI failures #620)
Cons:
- Adds a dependency (not too worried about this one since it's very commonly used and from PyPA)
- Would make our example code more verbose in places (don't love this, but I think it's a reasonable tradeoff)
If we decide not to move ahead with this, I think we should strive to be more explicit about what versions our code works with and/or note where there might be issues with backward compatibility.
Open to other suggestions / tools for handling this as well.