Skip to content

git

Module for Git utilities.

Functions:

Name Description
local_repo_commit_wandb_tags

Build a list of tags for logging (like with Weights and Biases) describing the git status of the given dependencies, if installed

local_repo_commit_wandb_tags

local_repo_commit_wandb_tags(
    *modules: ModuleType,
) -> list[str]

Build a list of tags for logging (like with Weights and Biases) describing the git status of the given dependencies, if installed locally.

A module is only attributed to a repository that actually tracks its file. Repository discovery searches parent directories, so without that check any module inside a virtual environment created within a checkout -- every installed package, in the common case -- would be reported as belonging to that checkout.

Parameters:

Name Type Description Default

*modules

ModuleType

The Python modules to build local install tags for.

required

Returns:

Type Description
list[str]

A list of string including the local repo's remote name, its current commit SHA or git tag (if an exact match), and the branch name

list[str]

(if not detached). Modules not tracked by any discoverable repository are skipped.

Raises:

Type Description
ImportError

If GitPython is not installed.