Install & Compatibility
Where this runs
tested against v21.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.018s · 19MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.020s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LegacyVersion
✓ from packvers.version import LegacyVersion
✗ from packaging.version import LegacyVersion
`LegacyVersion` is removed from `packaging` after 21.3; this fork restores it.
Version
✓ from packvers.version import Version
Same API as upstream `packaging.version.Version`.
SpecifierSet
✓ from packvers.specifiers import SpecifierSet
Same API as upstream.
Basic usage: parse and compare versions, including legacy format.
from packvers.version import Version, LegacyVersion
from packvers.specifiers import SpecifierSet
v = Version('1.2.3')
print(v) # 1.2.3
print(SpecifierSet('>=1.0').contains(v)) # True
# Legacy version support
lv = LegacyVersion('1.2.3a')
print(lv) # 1.2.3a
Errors
Common errors & fixes
from packvers.version import LegacyVersion
ImportError: cannot import name 'LegacyVersion' from 'packvers.version'
You may have an older version of `packvers` that doesn't include `LegacyVersion`, or you accidentally installed `packaging` instead.
fixUpgrade to `packvers>=21.5` with `pip install --upgrade packvers` and ensure `packaging` is not installed.
from packaging.version import LegacyVersion
ImportError: cannot import name 'LegacyVersion' from 'packaging.version'
`LegacyVersion` was removed from `packaging` in version 21.0.
fixUse `packvers.version.LegacyVersion` instead, or downgrade `packaging` to 20.9.
AttributeError: module 'packaging' has no attribute 'version'
You may have accidentally installed `packver` (wrong name) or the import path is incorrect.
fixUninstall conflicting packages and install `packvers` via `pip install packvers`.
Upgrade
Version history
21.5latest on PyPI · released Dec 22, 2022
Audit
Dependencies
No dependency data recorded yet.