verlib2 is a Python library that provides a standalone bundle of version parsing implementations, specifically `distutils.version` (PEP 386) and `packaging.version` (PEP 440). Its primary purpose is to offer these functionalities without requiring the `packaging` library as a dependency, and to provide a solution for projects that relied on `distutils.version` after `distutils` was removed from the Python standard library in Python 3.12. It is actively maintained with a steady release cadence.
pip install verlib2Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use both the PEP 440-compliant `Version` class and the PEP 386-compliant `LooseVersion` and `StrictVersion` classes for version comparison and parsing. It highlights the differences in parsing rules between the two standards, particularly regarding development suffixes and strictness.
Migrate `from distutils.version import LooseVersion` to `from verlib2.distutils.version import LooseVersion` (and similarly for `StrictVersion`).
Carefully choose the appropriate version class (`Version` for PEP 440, `LooseVersion` or `StrictVersion` for PEP 386) based on the specific versioning standard your project requires.
Replace `from distutils.version import ...` with `from verlib2.distutils.version import ...`.
Ensure all values being compared are instances of `verlib2.Version` (or `LooseVersion`/`StrictVersion`). For example, `Version('1.0') < Version('2.0')`.No dependency data recorded yet.