weaver.compat
Module Contents
- class weaver.compat.Version(version: str)[source]
This class abstracts handling of a project’s versions.
A
Versioninstance is comparison aware and can be compared and sorted using the standard Python interfaces.>>> v1 = Version("1.0a5") >>> v2 = Version("1.0") >>> v1 <Version('1.0a5')> >>> v2 <Version('1.0')> >>> v1 < v2 True >>> v1 == v2 False >>> v1 > v2 False >>> v1 >= v2 False >>> v1 <= v2 True
Versionis immutable; use__replace__()to change part of a version.Instances are safe to serialize with
pickle. They use a stable format so the same pickle can be loaded in future packaging releases.Changed in version 26.2: Added a stable pickle format. Pickles created with packaging 26.2+ can be unpickled with future releases. Backward compatibility with pickles from packaging < 26.2 is supported but may be removed in a future release.
Initialize a Version object.
- Parameters:
version – The string representation of a version which will be parsed and normalized before use.
- Raises:
InvalidVersion – If the
versiondoes not conform to PEP 440 in any way then this exception will be raised.