Skip to content
Back to top
View this page

# semantic_release.version.translator module

class semantic_release.version.translator.VersionTranslator(tag_format: str = 'v{version}', prerelease_token: str = 'rc', add_partial_tags: bool = False)

  Bases: `object`

  Class to handle translation from Git tags into their corresponding Version instances.

  from_string(version_str: str) → Version

    Return a Version instance from a string. Delegates directly to Version.parse, using the translator’s own stored values for tag_format and prerelease

  from_tag(tag: str) → Version | None

    Return a Version instance from a Git tag, if tag_format matches the format which would have generated the tag from a version. Otherwise return None. For example, a tag of ‘v1.2.3’ should be matched if tag_format = ‘v{version}, but not if tag_format = staging–v{version}.

  str_to_tag(version_str: str) → str

    Formats a version string into a tag name