repomatic.versions module¶
PEP 440 version primitives, shared by the whole package.
Every version this package reads comes from somewhere it does not control (a
lock file, a package index, a git tag), so parsing has to tolerate junk, and
nearly every module compares or normalizes versions somewhere. These helpers
used to live in repomatic.release.version_sync, whose import graph reaches the
GitHub, PyPI and npm clients: the modules below it in that graph each kept a
private two-line copy of the parse rather than close a cycle. A leaf module
with no dependency beyond packaging is what lets everyone import the one
copy.
- repomatic.versions.DEV_SUFFIX_RE = re.compile('\\.dev\\d*$')¶
Match the trailing PEP 440 developmental-release segment of a version.
- repomatic.versions.safe_version(value)[source]¶
Parse a PEP 440 version, returning
Nonefor anything unparsable.Collapsing the
try/except InvalidVersioninto one helper keeps the callers reading as the filters they are.