topmark.utils.version¶
Version utilities for TopMark.
ComputedVersion
dataclass
¶
Computed package version text and format metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
version_text |
str
|
The effective version string. |
version_format |
str
|
The format of |
error |
Exception | None
|
Conversion error when SemVer conversion was requested but failed. |
convert_pep440_to_semver ¶
Convert a PEP 440 version string to a SemVer-compatible string.
Maps
rcN -> -rc.N aN -> -alpha.N bN -> -beta.N devN -> -dev.N (after any pre-release) +local kept as-is
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pep440_version
|
str
|
The version in PEP 440 format |
required |
Returns:
| Type | Description |
|---|---|
str
|
The version in SemVer format. |
Raises:
| Type | Description |
|---|---|
ValueError
|
on post releases. |
Source code in src/topmark/utils/version.py
compute_version_text ¶
Compute the version string for TopMark.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
semver
|
bool
|
If True, attempt to convert the package's PEP 440 version to SemVer. |
required |
Returns:
| Type | Description |
|---|---|
ComputedVersion
|
Tuple ( |
ComputedVersion
|
If SemVer conversion is requested and fails, TopMark falls back to the original |
ComputedVersion
|
PEP 440 version string and returns: - version_text: the PEP 440 version - version_format: "pep440" - error: the conversion exception |
ComputedVersion
|
If SemVer conversion succeeds (or semver=False), |
Source code in src/topmark/utils/version.py
check_python_version ¶
Check if the current Python version meets the minimum requirement.