LooseVersion¶
- class audeer.LooseVersion(version=None)[source]¶
Version numbering for anarchists and software realists.
This implementation was originally part of
distutilsasversion.LooseVersion.A version number consists of a series of numbers, separated by either periods or strings of letters. When comparing version numbers, the numeric components will be compared numerically, and the alphabetic components lexically. The following are all valid version numbers, in no particular order:
'1.5.1,'1.5.2b2,'161','3.10a','8.02','3.4j','1996.07.12','3.2.pl0','3.1.1.6','2g6','11g','0.960923','2.2beta29','1.13++','5.5.kw','2.0b1pl0'.- Parameters:
version – version string
Examples
>>> v1 = audeer.LooseVersion("1.17.2") >>> v1 LooseVersion ('1.17.2') >>> v1.version [1, 17, 2] >>> v2 = audeer.LooseVersion("1.17.2-3-g70b71bd") >>> v1 < v2 True
__eq__()¶
__ge__()¶
__gt__()¶
__le__()¶
__lt__()¶
__repr__()¶
- LooseVersion.__repr__()¶
Python code to recreate instance.
__str__()¶
parse()¶
version¶
- LooseVersion.version¶
Parsed version.
version_re¶
- LooseVersion.version_re = re.compile('(\\d+ | [a-z]+ | \\.)', re.VERBOSE)¶
Version regexp pattern.
The regexp pattern is used to split the version into single components when parsing it.