hopsworks.core.git_api #
[source] GitApi #
Returned by
[source] clone #
clone(
url: str,
path: str,
provider: Literal["GitHub", "GitLab", "BitBucket"]
| None = None,
branch: str = None,
) -> git_repo.GitRepo
Clone a new Git Repo in to Hopsworks Filesystem.
import hopsworks
project = hopsworks.login()
git_api = project.get_git_api()
git_repo = git_api.clone("https://github.com/logicalclocks/hops-examples.git", "Resources", "GitHub")
| PARAMETER | DESCRIPTION |
|---|---|
url | URL to the git repository. TYPE: |
path | Path in Hopsworks Filesystem to clone the repo to. TYPE: |
provider | The git provider where the repo is currently hosted. TYPE: |
branch | The branch to clone, defaults to the configured default branch. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
git_repo.GitRepo | Git repository object. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
[source] get_providers #
get_providers() -> list[git_provider.GitProvider]
Get the configured Git providers.
| RETURNS | DESCRIPTION |
|---|---|
list[git_provider.GitProvider] | List of git provider objects. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
[source] get_provider #
get_provider(
provider: Literal["GitHub", "GitLab", "BitBucket"],
host: str = None,
) -> git_provider.GitProvider | None
Get the configured Git provider.
| PARAMETER | DESCRIPTION |
|---|---|
provider | Name of the git provider. TYPE: |
host | Optional host for the git provider, e.g., TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
git_provider.GitProvider | None | The git provider or |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
[source] set_provider #
set_provider(
provider: Literal["GitHub", "GitLab", "BitBucket"],
username: str,
token: str,
host: str = None,
)
Configure a Git provider.
import hopsworks
project = hopsworks.login()
git_api = project.get_git_api()
git_api.set_provider("GitHub", "my_user", "my_token", host="github.com")
| PARAMETER | DESCRIPTION |
|---|---|
provider | Name of the git provider. TYPE: |
username | Username for the git provider service. TYPE: |
token | Token to set for the git provider service. TYPE: |
host | Host for the git provider, e.g., TYPE: |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
[source] get_repo #
Get the cloned Git repository.
| PARAMETER | DESCRIPTION |
|---|---|
name | Name of the git repository. TYPE: |
path | Optional path to specify if multiple git repositories with the same name exist in the project. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
git_repo.GitRepo | None | The git repository or |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |