RL002: ValidVersion
Overview
| Property | Value |
|---|---|
| ID | RL002 |
| Name | ValidVersion |
| Group | release |
| Severity | ERROR |
Description
Checks that the package version follows semantic versioning (semver).
Semantic versioning provides a clear contract for version numbers:
MAJOR.MINOR.PATCHformat- Meaningful version increments
- Pre-release and build metadata support
What it checks
The check validates the version in pyproject.toml matches:
X.Y.Z
X.Y.Z-prerelease
X.Y.Za1 (alpha)
X.Y.Zb2 (beta)
X.Y.Zrc1 (release candidate)
X.Y.Zdev1 (development)
Valid examples
1.0.02.1.31.0.0a1(alpha)1.0.0b2(beta)1.0.0rc1(release candidate)1.0.0.dev1(development)
Invalid examples
1.0(missing patch)v1.0.0(no ‘v’ prefix)1.0.0.0(too many parts)latest(not a version number)
How to fix
Update the version in pyproject.toml:
[project]
version = "1.0.0"Semantic versioning rules
| Change | Version increment |
|---|---|
| Breaking API change | MAJOR (1.0.0 → 2.0.0) |
| New feature (backwards compatible) | MINOR (1.0.0 → 1.1.0) |
| Bug fix (backwards compatible) | PATCH (1.0.0 → 1.0.1) |
Pre-release versions
Use for testing before stable release:
version = "1.0.0a1" # Alpha 1
version = "1.0.0b1" # Beta 1
version = "1.0.0rc1" # Release candidate 1Configuration
Skip this check
[tool.pycmdcheck]
skip = ["RL002"]CLI
pycmdcheck --skip RL002