lib.packaging.version.*

exception lib.packaging.version.InvalidVersion[source]

Bases: ValueError

An invalid version was found, users should refer to PEP 440.

class lib.packaging.version.LegacyVersion(version)[source]

Bases: lib.packaging.version._BaseVersion

property base_version
Return type

str

property dev
Return type

None

property epoch
Return type

int

property is_devrelease
Return type

bool

property is_postrelease
Return type

bool

property is_prerelease
Return type

bool

property local
Return type

None

property post
Return type

None

property pre
Return type

None

property public
Return type

str

property release
Return type

None

class lib.packaging.version.Version(version)[source]

Bases: lib.packaging.version._BaseVersion

_regex = re.compile('^\\s*\n    v?\n    (?:\n        (?:(?P<epoch>[0-9]+)!)?                           # epoch\n        (?P<release>[0-9]+(?:\\.[0-9]+)*)                  # release segment\n        (?P<pre>              , re.IGNORECASE|re.VERBOSE)
property base_version
Return type

str

property dev
Return type

Optional[Tuple[str, int]]

property epoch
Return type

int

property is_devrelease
Return type

bool

property is_postrelease
Return type

bool

property is_prerelease
Return type

bool

property local
Return type

Optional[str]

property major
Return type

int

property micro
Return type

int

property minor
Return type

int

property post
Return type

Optional[Tuple[str, int]]

property pre
Return type

Optional[Tuple[str, int]]

property public
Return type

str

property release
Return type

Tuple[int, …]

lib.packaging.version.parse(version)[source]

Parse the given version string and return either a Version object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version.

Return type

Union[LegacyVersion, Version]