semantic_release.helpers module#

class semantic_release.helpers.ParsedGitUrl(scheme: str, netloc: str, namespace: str, repo_name: str)[source]#

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[source]#
semantic_release.helpers.dynamic_import(import_path: str) Any[source]#

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

semantic_release.helpers.format_arg(value: Any) str[source]#

Helper to format an argument an argument for logging

semantic_release.helpers.logged_function(logger: Logger) Callable[[Callable[[...], _R]], Callable[[...], _R]][source]#

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[source]#

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.