module documentation

.. testsetup:: from packaging.version import parse, Version

Class Version This class abstracts handling of a project's versions.
Exception InvalidVersion Raised when a version string is not a valid version.
Function parse Parse the given version string.
Type Alias CmpKey Undocumented
Type Alias InfiniteTypes Undocumented
Type Alias LocalType Undocumented
Type Alias PrePostDevType Undocumented
Type Alias SubLocalType Undocumented
Type Alias VersionComparisonMethod Undocumented
Class _BaseVersion Undocumented
Function _cmpkey Undocumented
Function _parse_letter_version Undocumented
Function _parse_local_version Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
Constant _VERSION_PATTERN A string containing the regular expression used to match a valid version.
Variable _local_version_separators Undocumented
Variable _Version Undocumented
def parse(version: str) -> Version: (source)

Parse the given version string. >>> parse('1.0.dev1') <Version('1.0.dev1')> :param version: The version string to parse. :raises InvalidVersion: When the version string is not a valid version.

InfiniteTypes = (source)
PrePostDevType = (source)

Undocumented

Value
Union[InfiniteTypes, Tuple[str, int]]
SubLocalType = (source)

Undocumented

Value
Union[InfiniteTypes, int, str]
VersionComparisonMethod = (source)

Undocumented

Value
Callable[[CmpKey, CmpKey], bool]
def _cmpkey(epoch: int, release: Tuple[int, ...], pre: Optional[Tuple[str, int]], post: Optional[Tuple[str, int]], dev: Optional[Tuple[str, int]], local: Optional[Tuple[SubLocalType]]) -> CmpKey: (source)

Undocumented

def _parse_letter_version(letter: str, number: Union[str, bytes, SupportsInt]) -> Optional[Tuple[str, int]]: (source)

Undocumented

def _parse_local_version(local: str) -> Optional[LocalType]: (source)

Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").

_VERSION_PATTERN: str = (source)

A string containing the regular expression used to match a valid version. The pattern is not anchored at either end, and is intended for embedding in larger expressions (for example, matching a version number as part of a file name). The regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE`` flags set. :meta hide-value:

Value
'''
    v?
    (?:
        (?:(?P<epoch>[0-9]+)!)?                           # epoch
        (?P<release>[0-9]+(?:\\.[0-9]+)*)                  # release segment
        (?P<pre>                                          # pre-release
            [-_\\.]?
...
_local_version_separators = (source)

Undocumented

_Version = (source)

Undocumented