LooseVersion

1.3.0 · active · verified Sun Apr 12

The `looseversion` package is a backwards/forwards-compatible fork of `distutils.version.LooseVersion`, designed for comparing heterogeneous version schemes that do not strictly follow PEP 440. It offers an identical interface and comparison logic to the original, with the main enhancement being comparability between `looseversion.LooseVersion` and `distutils.version.LooseVersion` instances. The current version is 1.3.0, released on July 5, 2023, and it aims to be a stable replacement for the deprecated `distutils` version class, with a relatively low release cadence focused on compatibility and maintenance.

Warnings

Install

Imports

Quickstart

Demonstrates basic version object creation and comparison, including comparison with a string literal.

from looseversion import LooseVersion

v1 = LooseVersion("1.0.0")
v2 = LooseVersion("2.0.0")

print(f"'{v1}' < '{v2}' is {v1 < v2}")
print(f"'{v1}' < '2' is {v1 < '2'}")

view raw JSON →