repo

class pcs.repo.GitHubRepo(identifier: str, url: str, default_version: str = 'master')

A Component with an GitHubRepo can be found on GitHub.

__init__(identifier: str, url: str, default_version: str = 'master')
classmethod from_spec(spec: Mapping[str, Mapping[str, str]]) pcs.repo.LocalRepo
get_local_file_path(file_path: str, version: Optional[str] = None) pathlib.Path
get_local_repo_dir(version: Optional[str] = None) pathlib.Path
to_spec(flatten: bool = False) Dict
class pcs.repo.LocalRepo(identifier: str, local_dir: Optional[Union[pathlib.Path, str]] = None)

A Component with a LocalRepo can be found on your local drive.

__init__(identifier: str, local_dir: Optional[Union[pathlib.Path, str]] = None)
classmethod from_spec(spec: Mapping[str, Mapping[str, str]], base_dir: Optional[str] = None) pcs.repo.LocalRepo
get_local_file_path(relative_path: str, version: Optional[str] = None) pathlib.Path
get_local_repo_dir(version: Optional[str] = None) pathlib.Path
to_spec(flatten: bool = False) Union[Mapping[str, Mapping[str, str]], Mapping[str, str]]
class pcs.repo.Repo(identifier: str, default_version: Optional[str] = None)

Base class used to encapsulate information about where a Component is located.

UNKNOWN_URL = 'unknown_url'
__init__(identifier: str, default_version: Optional[str] = None)
clear_repo_cache(assume_yes: bool = False) None

Completely removes all the repos that have been created or checked out in the repo_cache_path. Pass True to assume_yes to run non-interactively.

property default_version
classmethod from_github(github_account: str, repo_name: str, identifier: Optional[str] = None) pcs.repo.GitHubRepo
classmethod from_registry(registry: pcs.registry.Registry, identifier: str) pcs.repo.Repo
static from_spec(spec: Mapping[str, Mapping[str, str]], base_dir: Optional[str] = None) pcs.repo.Repo
abstract get_local_file_path(file_path: str, version: Optional[str] = None) pathlib.Path
abstract get_local_repo_dir(version: Optional[str] = None) pathlib.Path
get_prefixed_path_from_repo_root(identifier: pcs.identifiers.ComponentIdentifier, file_path: str) pathlib.Path

Finds the ‘component_path’ relative to the repo containing the Component. For example, if component_path is:

/foo/bar/baz/my_component.py

and a git repo lives in:

/foo/bar/.git/

then this would return:

baz/my_component.py
get_version_from_git(component_identifier: pcs.identifiers.ComponentIdentifier, file_path: str, force: bool = False) Tuple[str, str]

Given a path to a Component, this returns a git hash and GitHub repo URL where the current version of the Component is publicly accessible. This will raise an exception if any of the following checks are true:

  1. The Component is not in a git repo.

  2. The origin of this repo is not GitHub.

  3. The current local branch and corresponding remote branch are not at the same commit.

  4. There are uncommitted changes locally

If ‘’force’’ is True, checks 2, 3, and 4 above are ignored.

to_registry(registry: Optional[pcs.registry.Registry] = None, recurse: bool = True, force: bool = False) pcs.registry.Registry
abstract to_spec(flatten: bool = False) Union[Mapping[str, Mapping[str, str]], Mapping[str, str]]
class pcs.repo.RepoType(value)

An enumeration.

GITHUB = 'github'
LOCAL = 'local'