Skip to content

hopsworks.git_repo #

[source] GitRepo #

[source] id property #

Id of the git repo.

[source] name property #

Name of the git repo.

[source] path property #

Path to the git repo in the Hopsworks Filesystem.

[source] creator property #

Creator of the git repo.

[source] provider property #

Git provider for the repo, can be GitHub, GitLab or BitBucket.

[source] current_branch property #

The current branch for the git repo.

[source] current_commit property #

The current commit for the git repo.

[source] read_only property #

If True then the repository functions GitRepo.commit, GitRepo.push and GitRepo.checkout_files are forbidden.

[source] status #

status()

Get the status of the repo.

RETURNS DESCRIPTION

List[GitFileStatus]

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] delete #

delete()

Delete the git repo from the filesystem.

Potentially dangerous operation

This operation deletes the cloned git repository from the filesystem.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request

[source] checkout_branch #

checkout_branch(branch: str, create: bool = False)

Checkout a branch.

PARAMETER DESCRIPTION
branch

Name of the branch.

TYPE: str

create

If True, creates a new branch and checks it out.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] checkout_commit #

checkout_commit(commit: str)

Checkout a commit.

PARAMETER DESCRIPTION
commit

Hash of the commit.

TYPE: str

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] checkout_files #

checkout_files(files: list[str] | list[GitFileStatus])

Checkout a list of files.

PARAMETER DESCRIPTION
files

List of files or GitFileStatus objects to checkout.

TYPE: list[str] | list[GitFileStatus]

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] delete_branch #

delete_branch(branch: str)

Delete a branch from local repository.

PARAMETER DESCRIPTION
branch

Name of the branch to delete.

TYPE: str

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] commit #

commit(
    message: str, all: bool = True, files: list[str] = None
)

Add changes and new files, and then commit them.

PARAMETER DESCRIPTION
message

Commit message.

TYPE: str

all

Automatically stage files that have been modified and deleted, but new files are not affected.

TYPE: bool DEFAULT: True

files

List of new files to add and commit.

TYPE: list[str] DEFAULT: None

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] push #

push(branch: str, remote: str = 'origin')

Push changes to the remote branch.

PARAMETER DESCRIPTION
branch

Name of the branch.

TYPE: str

remote

Name of the remote.

TYPE: str DEFAULT: 'origin'

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] pull #

pull(branch: str, remote: str = 'origin')

Pull changes from remote branch.

PARAMETER DESCRIPTION
branch

Name of the branch.

TYPE: str

remote

Name of the remote.

TYPE: str DEFAULT: 'origin'

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] fetch #

fetch(remote: str = None, branch: str = None)

Fetch changes from remote.

PARAMETER DESCRIPTION
remote

Name of the remote.

TYPE: str DEFAULT: None

branch

Name of the branch.

TYPE: str DEFAULT: None

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] reset #

reset(
    remote: str = None,
    branch: str = None,
    commit: str = None,
)

Reset the branch to a specific commit or to a local branch or to a remote branch.

PARAMETER DESCRIPTION
remote

Name of the remote.

TYPE: str DEFAULT: None

branch

Name of the branch.

TYPE: str DEFAULT: None

commit

Hash of the commit.

TYPE: str DEFAULT: None

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] get_commits #

get_commits(branch: str) -> list[git_commit.GitCommit]

Get the commits for the repo and branch.

PARAMETER DESCRIPTION
branch

Name of the branch.

TYPE: str

RETURNS DESCRIPTION
list[git_commit.GitCommit]

The list of commits for this repo.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] add_remote #

add_remote(name: str, url: str) -> GitRemote

Add a remote for the repo.

import hopsworks

project = hopsworks.login()

git_api = project.get_git_api()

repo = git_api.get_repo("my_repo")

repo.add_remote("upstream", "https://github.com/organization/repo.git")
PARAMETER DESCRIPTION
name

Name of the remote.

TYPE: str

url

Url of the remote.

TYPE: str

RETURNS DESCRIPTION
GitRemote

The created remote.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] get_remote #

get_remote(name: str) -> GitRemote

Get a remote by name for the repo.

PARAMETER DESCRIPTION
name

Name of the remote.

TYPE: str

RETURNS DESCRIPTION
GitRemote

The git remote metadata object or None if it does not exist.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] get_remotes #

get_remotes() -> list[GitRemote]

Get the configured remotes for the repo.

RETURNS DESCRIPTION
list[GitRemote]

All remotes of the git repo.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.