[Feature Request] Matplotlib "gr" Backend Support
This feature request comes courtesy @dglmoore, who astutely outed the open-source GR Framework as a potential best-of-breed Matplotlib backend. GR provides a Pythonic C extension with the fully-qualified package name
gr doubling as a third-party Matplotlib backend of the same name purportedly faster than all built-in Matplotlib backends. That's probably not saying much. Still, if true, then nice.
A third-party [Mini|Ana]conda package repository hosting
conda-managed GR packages simplifies cross-platform installation to the following one-liner:
conda install -c https://conda.anaconda.org/jheinen gr
All is not well in GR Land, however. grrrrrrrrrr
Give Me Optional GR or Give Me Matplotlib Death
If we do elect to add GR support to BETSE, we should probably do so in an optional rather than mandatory manner. It's not that BETSE is already over-burdened by the weight of one too many mandatory dependencies like a wheezing donkey train shuddering through the irradiated wastes of a post-fallout Sonoran desert, though that's absolutely the case. It's that:
- GR is not in Anaconda's default package list and hence not shipped out-of-the-box with the default Anaconda installation.
- GR installation is non-trivial for users (namely, me) preferring platform-specific package management to Anaconda. There currently exists no first- or third-party ebuilds for installing GR on Gentoo Linux, for example.
- GR doesn't appear to provide any substantial features above and beyond those provided by Matplotlib. It's just faster. Faster is nice, but hardly mandatory.
Back in Backend Black
Presumably, this limits the scope of GR usage in BETSE to that of an optional Matplotlib backend. While GR is importable directly and hence usable outside of a strict Matplotlib context as an incompatible alternative to Matplotlib-based APIs (e.g., animation, video encoding), there's really no sane way to do so without requiring GR as a mandatory dependency.
Ergo, Matplotlib backend. To do so, consider improving our
MatplotlibConfig.init() method to preferentially perform the following before defaulting to a platform-specific backend:
- If the top-level
grpackage is importable, enable the
- Else, fallback to a platform-specific backend.
Since it's simple, it's low-hanging fruit – assuming I manage to install it under Gentoo, anyway. Let's pluck the bitter rind!