mafw.devtools.versions
Shared version parsing and formatting primitives for devtools.
PEP 440 distribution versions, Python interpreter minors, and version-bearing filenames have distinct syntax. This module centralizes their parsing while leaving caller-specific policy and error messages at their boundaries.
- author:
Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
Module Attributes
Exact syntax for a Python |
|
Exact syntax for a stable project tag; callers must use |
|
Exact syntax for a Python reference lock filename; use |
Functions
|
Build the reference lock filename for a Python minor token. |
|
Parse value as a PEP 440 version using |
|
Parse an exact pylock reference filename, accepting a path-like input. |
|
Convert a dotted Python minor token to the filename-safe underscore form. |
Classes
|
A structural Python |
- class mafw.devtools.versions.PythonMinorVersion(major: int, minor: int)[source]
Bases:
objectA structural Python
major.minorvalue for numeric ordering.- classmethod parse(value: str) PythonMinorVersion[source]
Parse an exact
major.minortoken without applying project policy.
- mafw.devtools.versions.build_pylock_reference_filename(python_version: str) str[source]
Build the reference lock filename for a Python minor token.
- mafw.devtools.versions.parse_pep440_version(value: str) Version[source]
Parse value as a PEP 440 version using
packaging.version.Version.
- mafw.devtools.versions.parse_pylock_reference_filename(file_name: str) tuple[str, str] | None[source]
Parse an exact pylock reference filename, accepting a path-like input.
- mafw.devtools.versions.pylock_version_tag(python_version: str) str[source]
Convert a dotted Python minor token to the filename-safe underscore form.
- mafw.devtools.versions.PYLOCK_REFERENCE_PATTERN: Final[Pattern[str]] = re.compile('pylock\\.py(?P<python_version>3_\\d+)_ref\\.toml')
Exact syntax for a Python reference lock filename; use
fullmatch.
- mafw.devtools.versions.PYTHON_MINOR_PATTERN: Final[Pattern[str]] = re.compile('(?P<major>\\d+)\\.(?P<minor>\\d+)')
Exact syntax for a Python
major.minorselector.
- mafw.devtools.versions.STABLE_TAG_PATTERN: Final[Pattern[str]] = re.compile('v(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<micro>\\d+)')
Exact syntax for a stable project tag; callers must use
fullmatch.