weaver.compat

Module Contents

class weaver.compat.Version(version: str)[source]

This class abstracts handling of a project’s versions.

A Version instance 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

Initialize a Version object.

Parameters

version – The string representation of a version which will be parsed and normalized before use.

Raises

InvalidVersion – If the version does not conform to PEP 440 in any way then this exception will be raised.

property version: Tuple[Union[int, str], Ellipsis][source]
property patch[source]