You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add easily comparable version info to toplevel #18312
Currently matplotlib only exposes __version__. For quick version checks, exposing either a version_info tuple (which can be compared with other tuples) or a LooseVersion instance (which can be properly compared with other strings) would be a small usability improvement.
(In practice I guess boring string comparisons will work just fine until we hit mpl 3.10 or 4.10 which is unlikely to happen soon, but that feels quite dirty :))
Proposed Solution
I guess I slightly prefer LooseVersion, but exposing just a version_info tuple is much more common in other packages (and perhaps simpler to understand). The hardest(?) part is probably just bikeshedding this point :-)
Additional context and prior art
version_info is a pretty common thing (citation needed).
Python itself has the string sys.version and the (named)tuple sys.version_info. In analogy to that __version_info__ next to __version__ makes sense for packages.
Activity
timhoffm commentedon Nov 1, 2020
It seems that
__version_info__is the way to go.Prior art
There's no official specification for version tuples. PEP 396 - Module Version Numbers only defines the string
__version__.Many projects don't bother with version tuples.
When they do,
__version_info__seems to be a common thing:Python itself has the string sys.version and the (named)tuple sys.version_info. In analogy to that
__version_info__next to__version__makes sense for packages.