fastsandpm.versioning API
Semantic versioning and version specification subpackage.
This subpackage provides classes and functions for parsing, comparing, and resolving semantic versions used throughout FastSandPM. It supports standard semantic versioning with extensions for pre-release identifiers.
- Supported Version Formats:
Standard:
major.minor.patch(e.g., “1.2.3”)Pre-release with separator:
major.minor.patch-pre(e.g., “1.2.3-alpha”)Pre-release with dot:
major.minor.patch.pre(e.g., “1.2.3.rc1”)
- Supported Specifier Formats:
Direct version:
"1.0.0"(exact match)Caret requirement:
"^1.2.3"(semver-compatible)Comparison:
">=1.0.0","<2.0.0"Range:
">=1.0.0,<2.0.0"
- Included Classes:
- py:enim`~library_version.PreReleaseStage`:
Enum for pre-release stages.
- py:class`~library_version.LibraryVersion`:
Represents and compares semantic versions.
- py:class`~specifier.VersionSpecifier`:
Abstract base class for version specifications.
- py:class`~specifier.DirectVersionSpecifier`:
Matches a single version exactly.
- py:class`~specifier.CaretVersionSpecifier`:
Matches semver-compatible versions (^x.y.z).
- py:class`~specifier.ComparisonVersionSpecifier`:
Matches using comparison operators.
- py:class`~specifier.RangeVersionSpecifier`:
Matches versions within a range.
Included Functions:
meets_constraints(): Check if a version meets specified constraints.
find_compatible_version(): Find the best matching version from a list of options.
version_specifier_from_str(): Parse a version specifier string.
Example
>>> from fastsandpm.versioning import LibraryVersion, version_specifier_from_str
>>> v = LibraryVersion("1.2.3")
>>> spec = version_specifier_from_str("^1.0.0")
>>> spec.satisfied_by(v)
True
Modules
Semantic version representation and comparison. |
|
Version specifier classes for dependency constraints. |