class_docstr: This class abstracts handling of a project's versions.
  
  A :class:`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
docstr: Initialize a Version object.
  
  :param 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.
code: def __init__(self, version: str) -> None:
      """Initialize a Version object.
  
      :param 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.
      """
  
      # Validate the version and parse it into pieces
      match = self._regex.search(version)
      if not match:
          raise InvalidVersion(f"Invalid version: '{version}'")
  
      # Store the parsed out pieces of the version
      self._version = _Version(
          epoch=int(match.group("epoch"))
          if match.group("epoch")
          else 0,
          release=tuple(
              int(i) for i in match.group("release").split(".")
          ),
          pre=_parse_letter_version(
              match.group("pre_l"), match.group("pre_n")
          ),
          post=_parse_letter_version(
              match.group("post_l"),
              match.group("post_n1") or match.group("post_n2"),
          ),
          dev=_parse_letter_version(
              match.group("dev_l"), match.group("dev_n")
          ),
          local=_parse_local_version(match.group("local")),
      )
  
      # Generate a key which will be used for sorting
      self._key = _cmpkey(
          self._version.epoch,
          self._version.release,
          self._version.pre,
          self._version.post,
          self._version.dev,
          self._version.local,
      )
  
imports: import itertools
  import re
  from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union
  from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
label_desc: Use image node_id 1 to create a new Version object from inherited base classes: _BaseVersion with example: obj = Version(version)