traitlets icon indicating copy to clipboard operation
traitlets copied to clipboard

parse version_info from __version__

Open minrk opened this issue 3 years ago • 0 comments

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("."),)

minrk avatar Jun 17 '22 12:06 minrk