semantic_release.version.translator module#
- class semantic_release.version.translator.VersionTranslator(tag_format: str = 'v{version}', prerelease_token: str = 'rc')[source]#
Bases:
object
Class to handle translation from Git tags into their corresponding Version instances.
- from_string(version_str: str) Version [source]#
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 [source]#
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}.