traitlets
traitlets copied to clipboard
parse version_info from __version__
rather than the other way around, since tooling doesn't seem to support building version strings from version tuples these days.
use lighter subset of pep440 since we don't need every kind of version it can handle
alternative: use packaging.version.Version for parsing, build tuple from there, e.g.
_v = Version(__version__)
version_info = _v.release # (x, y, z)
if v.pre or v.dev or v.post:
version_info = version_info + (__version__[len(_v.base_version):].lstrip("."),)