idmtools.utils.gitrepo module#
Utilities for getting information and examples from gitrepos.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.utils.gitrepo.GitRepo(repo_owner: str | None = None, repo_name: str | None = None)[source]#
Bases:
object
GitRepo allows interaction with remote git repos, mainly for examples.
- property path#
Path property.
- Returns:
Return path property
- property branch#
Branch property.
- Returns:
Return branch property
- property verbose#
Return verbose property.
- Returns:
Return verbose property
- property repo_home_url#
Construct repo home url.
Returns: repo home url
- property repo_example_url#
Construct repo example url.
Returns: repo example url
- property api_example_url#
Construct api url of the examples for download.
Returns: api url
- parse_url(url: str, branch: str | None = None, update: bool = True)[source]#
Parse url for owner, repo, branch and example path.
- Parameters:
url – example url
branch – user branch to replace the branch in url
update – True/False - update repo or not
Returns: None
- list_public_repos(repo_owner: str | None = None, page: int = 1, raw: bool = False)[source]#
Utility method to retrieve all public repos.
- Parameters:
repo_owner – the owner of the repo
page – pagination of results
raw – bool - return rwo data or simplified list
Returns: repo list
- list_repo_releases(repo_owner: str | None = None, repo_name: str | None = None, raw: bool = False)[source]#
Utility method to retrieve all releases of the repo.
- Parameters:
repo_owner – the owner of the repo
repo_name – the name of repo
raw – bool - return raw data or simplified list
Returns: the release list of the repo
- download(path: str = '', output_dir: str = './', branch: str = 'main') int [source]#
Download files with example url provided.
- Parameters:
path – local file path to the repo
output_dir – user local folder to download files to
branch – specify branch for files download from
Returns: total file count downloaded