Skip to content

Git

feu.local_git

Contain git utility functions.

feu.local_git.get_last_tag_name

get_last_tag_name(raise_error: bool = True) -> str | None

Get the name of the most recent tag in the current repository.

Parameters:

Name Type Description Default
raise_error bool

If True, a RuntimeError is raised when no tag is found. If False, None is returned instead.

True

Returns:

Type Description
str | None

The tag name, or None if no tag was found and raise_error=False.

Raises:

Type Description
RuntimeError

if no tag was found and raise_error=True.

Example
>>> from feu.local_git import get_last_tag_name
>>> tag = get_last_tag_name()
>>> tag
>>> tag = get_last_tag_name(raise_error=False)
>>> tag

feu.local_git.get_last_version_tag_name

get_last_version_tag_name(
    raise_error: bool = True,
) -> str | None

Get the name of the most recent version tag in the current repository.

A version tag is a tag starting with v{number}*.

Parameters:

Name Type Description Default
raise_error bool

If True, a RuntimeError is raised when no version tag is found. If False, None is returned instead.

True

Returns:

Type Description
str | None

The tag name, or None if no version tag was found and raise_error=False.

Raises:

Type Description
RuntimeError

if no version tag was found and raise_error=True.

Example
>>> from feu.local_git import get_last_version_tag_name
>>> tag = get_last_version_tag_name()
>>> tag
>>> tag = get_last_version_tag_name(raise_error=False)
>>> tag

feu.local_git.get_tags

get_tags() -> list[TagReference]

Get the list of git tags sorted by date/time for the current repository.

Returns:

Type Description
list[TagReference]

The list of git tags sorted by date/time.

Example
>>> from feu.local_git import get_tags
>>> tags = get_tags()
>>> tags