idiap_devtools.gitlab

Utilities to interact with GitLab.

Functions

download_path(package, path[, output, ref])

Download paths from gitlab, with an optional recurse.

get_gitlab_instance()

Return an instance of the gitlab object for remote operations.

idiap_devtools.gitlab.get_gitlab_instance()[source]

Return an instance of the gitlab object for remote operations.

Return type:

Gitlab

idiap_devtools.gitlab.download_path(package, path, output=None, ref=None)[source]

Download paths from gitlab, with an optional recurse.

This method will download an archive of the repository from chosen reference, and then it will search inside the zip blob for the path to be copied into output. It uses zipfile.ZipFile to do this search. This method will not be very efficient for larger repository references, but works recursively by default.

Parameters:
  • package (Project) – the gitlab package object to use (should be pre-fetched)

  • path (str) – the path on the project to download

  • output (Path | None) – where to place the path to be downloaded - if not provided, use the basename of path as storage point with respect to the current directory

  • ref (str | None) – the name of the git reference (branch, tag or commit hash) to use. If None specified, defaults to the default branch of the input package

Return type:

None