Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Edit this page
Toggle table of contents sidebar

# pontos.version.schemes package

pontos.version.schemes.VERSIONING_SCHEMES: dict[str, type[VersioningScheme]] = {'pep440': <class 'pontos.version.schemes._pep440.PEP440VersioningScheme'>, 'semver': <class 'pontos.version.schemes._semantic.SemanticVersioningScheme'>}

  Dictionary with available versioning schemes

pontos.version.schemes.versioning_scheme_argument_type(value)

  Verifies if the passed value is a valid versioning scheme and returns the corresponding versioning scheme.

  Intended to be used as in ArgumentParser.add_argument as the type.

  Raises:

    ArgumentTypeError – If the passed value is not a valid versioning scheme

  Return type:

    type[VersioningScheme]

  Example

      from argparse import ArgumentParser
      from pontos.version.scheme versioning_scheme_argument_type

      parser = ArgumentParser()
      parser.add_argument(
          "--versioning-scheme",
          type=versioning_scheme_argument_type,
      )

class pontos.version.schemes.VersioningScheme

  An abstract base class for versioning schemes

  Example

  Example on how to implement a new VersioningScheme

      from pontos.version.scheme import VersioningScheme

      class MyVersioningScheme(VersioningScheme):
          version_cls = MyVersion
          version_calculator_cls = MyVersionCalculator

  classmethod parse_version(version)

    Parse a version from a version string

    Raises:

      pontos.version.error.VersionError – If the version string contains an invalid version

    Returns:

      A version instance

    Return type:

      Version

  classmethod calculator()

    Return a matching version calculator for the implemented versioning schema.

    Returns:

      A version calculator

    Return type:

      Type[VersionCalculator]

class pontos.version.schemes.PEP440VersioningScheme

  PEP 440 versioning scheme

  version_calculator_cls

    alias of `PEP440VersionCalculator`

  version_cls

    alias of `PEP440Version`

class pontos.version.schemes.SemanticVersioningScheme
  version_cls

    alias of `SemanticVersion`

  version_calculator_cls

    alias of `SemanticVersionCalculator`