» Changelog | PyPI | Issues | Source code | License
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.
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.
pip install verlib2from 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 VersionAlyssa 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.
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.
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.
Set up package in development mode.
python3 -m venv .venv
source .venv/bin/activate
pip install --editable='.[develop,test]'Run software tests.
poe checkSpecial thanks to the people at JetBrains s.r.o. for supporting us with excellent development tooling.