Skip to content
Back to top
View this page

# semantic_release.helpers module

class semantic_release.helpers.ParsedGitUrl(scheme: str, netloc: str, namespace: str, repo_name: str)

  Bases: `NamedTuple`

  Container for the elements parsed from a git URL

  namespace: str

    Alias for field number 2

  netloc: str

    Alias for field number 1

  repo_name: str

    Alias for field number 3

  scheme: str

    Alias for field number 0

semantic_release.helpers.check_tag_format(tag_format: str) → None

semantic_release.helpers.dynamic_import(import_path: str) → Any

  Dynamically import an object from a conventionally formatted “module:attribute” string

semantic_release.helpers.format_arg(value: Any) → str

  Helper to format an argument an argument for logging

semantic_release.helpers.get_number_from_str(string: str, default: int = -1, interpret_hex: bool = False) → int

semantic_release.helpers.logged_function(logger: Logger) → Callable[[_FuncType[_R]], _FuncType[_R]]

  Decorator which adds debug logging of a function’s input arguments and return value.

  The input arguments are logged before the function is called, and the return value is logged once it has completed.

  Parameters:

    logger – Logger to send output to.

semantic_release.helpers.parse_git_url(url: str) → ParsedGitUrl

  Attempt to parse a string as a git url http[s]://, git://, file://, or ssh format, into a ParsedGitUrl.

  supported examples:

    http://git.mycompany.com/username/myproject.git https://github.com/username/myproject.git https://gitlab.com/group/subgroup/myproject.git https://git.mycompany.com:4443/username/myproject.git git://host.xz/path/to/repo.git/ git://host.xz:9418/path/to/repo.git/ git@github.com:username/myproject.git <– assumes ssh:// ssh://git@github.com:3759/myproject.git <– non-standard, but assume user 3759 ssh://git@github.com:username/myproject.git ssh://git@bitbucket.org:7999/username/myproject.git git+ssh://git@github.com:username/myproject.git /Users/username/dev/remote/myproject.git <– Posix File paths file:///Users/username/dev/remote/myproject.git C:/Users/username/dev/remote/myproject.git <– Windows File paths file:///C:/Users/username/dev/remote/myproject.git

  REFERENCE: https://stackoverflow.com/questions/31801271/what-are-the-supported-git-url-formats

  Raises ValueError if the url can’t be parsed.

semantic_release.helpers.sort_numerically(iterable: Iterable[str], reverse: bool = False, allow_hex: bool = False) → list[str]

semantic_release.helpers.text_reducer(text: str, filter_pair: tuple[Pattern[str], str]) → str

  Reduce function to apply mulitple filters to a string

semantic_release.helpers.validate_types_in_sequence(sequence: Sequence[Any], types: type | tuple[type, ...]) → bool

  Validate that all elements in a sequence are of a specific type