Provides needed Git utilities to manage the local checked out packages.

The packages are stored in: ~/returnn/pkg (Can be configured via env RETURNN_PKG_PATH)

We might have multiple checkouts of the same repo. In this case, we want to share the object files. We are using git worktree for this.


Note about our terminology (esp vs Go terminology):

Go differentiates between packages, modules and repositories, and even major semantic version sub-directories inside the modules. We do not make this distinction. You have a repository, and some specific commit, and the file path inside the repo. The file path might be sth like to note that it is incompatible from an earlier version.

Note about our version (revision) format:

During development, you would want to work in a live working tree. There is a working tree in ...repo, and version=None refers to that.

Once development of one piece/module/package is ready, you always should specify the version explicitly. The format is <date>-<commit>, where date should be like YYYYMMDDHHMMSS (can potentially be shorter up to YYYYMMDD) and commit is a revision, with minimum 7 numbers of digits.

Note about our repo format:

Currently always assumed to be remote, and then cached in our repo cache.

returnn.import_.git.stat_repo(repo, version)[source]#
  • repo (str) – e.g. “”

  • version (str|None) – e.g. “20211231-0123abcd0123”

returnn.import_.git.get_repo_path(repo, version, _report_dev_version_usage_stack_frame_depth=1)[source]#
  • repo (str) – e.g. “”

  • version (str|None) – e.g. “20211231-0123abcd0123”

  • _report_dev_version_usage_stack_frame_depth (int) –


path to repo

Return type: