Skip to main content

verlib2

Tests Test coverage Python versions

License Status PyPI Downloads

» Changelog | PyPI | Issues | Source code | License

About

A standalone bundle of distutils.version and packaging.version, without anything else.

verlib and Distutils are the implementations of PEP 386. packaging.version is the implementation of PEP 440. verlib2 bundles both of them into a standalone package.

To retain backward compatibility with earlier versions of Python, syntax features like PEP 570 have been removed from the original code.

Rationale

Everyone needs to compare versions, but no one wants to add packaging as a dependency. distutils is deprecated, and Python 3.12 removed it from the standard library.

Following PEP 632 to leave distutils behind, we found that people started bundling pep440.py files into their projects, causing some redundancy across the board.

Setup

pip install verlib2

Usage

from verlib2 import Version

assert Version("1.0.dev456") < Version("1!1.2.rev33+123456") 

Note: The verlib2.Version symbol links to verlib2.packaging.version, effectively providing packaging's Version class as the default variant. Both implementations can be accessed like this:

from verlib2.distutils.version import LooseVersion, StrictVersion
from verlib2.packaging.version import Version

Versioning

The version numbering of verlib2 follows that of the packaging package, because most changes to verlib2.packaging.version are mirroring corresponding updates to packaging.version.

Acknowledgements

Alyssa Coghlan, Andrew Kuchling, Donald Stufft, Greg Stein, Greg Ward, Tarek Ziadé, and all contributors to PEP-0386, PEP-0440 and their predecessors, including other members of the Python Distutils-SIG and authors and contributors to the distutilsversion, verlib, distutils, distutils2, packaging.version packages.

Other projects

Notable other projects are pep440-rs and pep440-version-utils if you need better speed or more features. The former implements PEP440 in Rust, and the latter makes it easier to handle version bumps, also following the PEP440 specification. Both packages require Python 3.8 and higher.

Prior Art

We had a look at the pep440, pep440deb, pep440nz, pep440-utility, and version-utils, but apparently, they did not include what we have been looking for.

Development

Set up package in development mode.

python3 -m venv .venv
source .venv/bin/activate
pip install --editable='.[develop,test]'

Run software tests.

poe check

Supported by

JetBrains logo.

Special thanks to the people at JetBrains s.r.o. for supporting us with excellent development tooling.

Metadata

Release files for verlib2 26.2

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

Source distribution (sdist)

Source distribution for verlib2 26.2
File Size Uploaded
verlib2-26.2.tar.gz 22.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for verlib2 26.2
File Interpreter ABI Platform
verlib2-26.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / verlib2-26.2.tar.gz

Download URL verlib2-26.2.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0740a3b35755a9d8ebb933ffce989f3776113fe319ab62df5fa20f7c14343d58
BLAKE2b-256 checksum
How to use checksums
21df59fe672f68746501c751a164ddafcc3b0098291c9a1c8ac46cb6967945ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / verlib2-26.2-py3-none-any.whl

Download URL verlib2-26.2-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ab3a7b1f51d363a90c07e507f50d019b203f4c9872348f5c0fd9fa0030bd7b6
BLAKE2b-256 checksum
How to use checksums
523eea072bbc4b5743e63b112dce38a0642af2af8605dd7cf07f147eac469cc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

26.2 This release

2 release files

26.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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