Skip to main content

Version-Tools

semantic-version-tools provides Vers, a Python class for parsing, comparing and incrementing version numbers. It supports Python 3.10–3.15.

Installation

Install from PyPI with pip or add the package to a uv project.

pip install semantic-version-tools
uv add semantic-version-tools

Usage

>>> from semantic_version_tools import Vers
>>> Vers("1.2")
Version 1.2
>>> Vers((1, 2, 0, "d", 1))
Version 1.2.0-devel.1
>>> Vers("1.2-dev.1+sha.abc").full()
'1.2.0-devel.1+sha.abc'
>>> Vers("1.2.0-rc.1") < Vers("1.2.0")
True

Tuples contain two to five fields in this order: major, minor, patch, prerelease code and build number. The prerelease codes are d (development), a (alpha), b (beta), rc (release candidate) and f (final). A prerelease string with an omitted patch uses patch zero. Metadata after + is preserved in the full version and ignored in comparisons. short() returns the numeric version without the prerelease or metadata.

Addition returns a new Vers instance. Integers increment the minor component. Floats use the integer and fractional digits as major and minor increments. Adding another Vers combines the numeric components and preserves the left operand's precision and release information.

>>> current = Vers("1.2.3")
>>> current + 1
Version 1.3.3
>>> current + 1.2
Version 2.4.3
>>> current
Version 1.2.3
>>> current += Vers("1.0.1")
>>> current
Version 2.2.4

Development

git clone https://github.com/RomoloPoliti-INAF/version-tools.git
cd version-tools
uv sync --locked
uv run --locked ruff check
uv run --locked ruff format --check
uv run --locked pytest --cov=semantic_version_tools --cov-branch --cov-report=term-missing --cov-fail-under=80
uv build

Metadata

Release files for semantic-version-tools 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semantic-version-tools 1.5.0
File Size Uploaded Provenance Actions
semantic_version_tools-1.5.0.tar.gz 3.9 kB Without provenance Details for semantic_version_tools-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for semantic-version-tools 1.5.0
File Interpreter ABI Platform Actions
semantic_version_tools-1.5.0-py3-none-any.whl Python 3 none any Details for semantic_version_tools-1.5.0-py3-none-any.whl

Total release size: 7.9 kB

Release files / semantic_version_tools-1.5.0.tar.gz

Download URL semantic_version_tools-1.5.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8f6eca05157552f6901b8c19ba42e41979e36e964bef4450f8dbc19de2d8deff
BLAKE2b-256 checksum
How to use checksums
2c5c9d1f3219aa2239347fae8031035dee8d04cabb4a819b70f173e2ec224fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / semantic_version_tools-1.5.0-py3-none-any.whl

Download URL semantic_version_tools-1.5.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b11413cf61f189a59055f48356ccde4a5776e242ed6b68b3a1f57d0f1297407
BLAKE2b-256 checksum
How to use checksums
507a1ec1c0fbcb8b668a732fc68fba3b499d877c0300924bfd30a7966b61c50d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for semantic-version-tools 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page