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

# semantic_release.version.version module

class semantic_release.version.version.Version(major: int, minor: int, patch: int, *, prerelease_token: str = 'rc', prerelease_revision: int | None = None, build_metadata: str = '', tag_format: str = 'v{version}')

  Bases: `object`

  as_semver_tag() → str
  as_tag() → str
  bump(level: LevelBump) → Version

    Return a new Version instance according to the level specified to bump. Note this will intentionally drop the build metadata - that should be added elsewhere for the specific build producing this version.

  finalize_version() → Version
  property is_prerelease: bool
  classmethod parse(version_str: str, tag_format: str = 'v{version}', prerelease_token: str = 'rc') → Version

    Parse version string to a Version instance. Inspired by semver.version:VersionInfo.parse, this implementation doesn’t allow optional minor and patch versions.

    Parameters:

      prerelease_token – will be ignored if the version string is a prerelease, the parsed token from version_str will be used instead.

  property tag_format: str
  to_prerelease(token: str | None = None, revision: int | None = None) → Version