Flexible Version Handling

0.1.0 · active · verified Sat Apr 11

verspec is a Python library for handling software versions and specifiers, adapted from the `packaging` package. It provides a flexible API for parsing, comparing, and working with version strings, supporting both 'loose' and 'Python' (PEP 440) version schemes. The current version is 0.1.0, released in November 2020. As an initial release, its release cadence is not yet established.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import and use both the 'loose' and 'python' (PEP 440 compliant) version and specifier classes to check if a version satisfies a given specifier.

from verspec import loose, python

# Using the 'loose' version scheme
v_loose = loose.Version('1.0')
s_loose = loose.SpecifierSet('~=1.0')
assert v_loose in s_loose
print(f"Loose Version '{v_loose}' is in specifier '{s_loose}': {v_loose in s_loose}")

# Using the 'python' (PEP 440) version scheme
v_python = python.Version('1.0')
s_python = python.SpecifierSet('~=1.0')
assert v_python in s_python
print(f"Python Version '{v_python}' is in specifier '{s_python}': {v_python in s_python}")

view raw JSON →