From b1169f58588d2527699433345e51fe2c0211681c Mon Sep 17 00:00:00 2001 From: peterschmidt85 Date: Tue, 19 Sep 2023 21:28:45 +0200 Subject: [PATCH] - [API] Bugfix - `dstack.Client.from_config` didn't work without `dstack init` --- cli/dstack/__init__.py | 7 +++++-- docs/docs/reference/api/python/index.md | 5 ++++- docs/examples/python-api.md | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cli/dstack/__init__.py b/cli/dstack/__init__.py index e8adb12fe..e81a9f596 100644 --- a/cli/dstack/__init__.py +++ b/cli/dstack/__init__.py @@ -296,10 +296,10 @@ def __init__( self, hub_client: HubClient, repo_dir: os.PathLike, - init: bool = True, git_identity_file: Optional[str] = None, oauth_token: Optional[str] = None, ssh_identity_file: Optional[str] = None, + init: bool = True, ) -> None: super().__init__() self._hub_client = hub_client @@ -317,6 +317,9 @@ def from_config( project_name: Optional[str] = None, server_url: Optional[str] = None, user_token: Optional[str] = None, + git_identity_file: Optional[str] = None, + oauth_token: Optional[str] = None, + ssh_identity_file: Optional[str] = None, local_repo: bool = False, ): if server_url is not None and user_token is not None: @@ -332,4 +335,4 @@ def from_config( hub_client = get_hub_client( project_name=project_name, repo_dir=repo_dir, local_repo=local_repo ) - return Client(hub_client, repo_dir, local_repo) + return Client(hub_client, repo_dir, git_identity_file, oauth_token, ssh_identity_file) diff --git a/docs/docs/reference/api/python/index.md b/docs/docs/reference/api/python/index.md index 15a07b017..b8e1ef8b3 100644 --- a/docs/docs/reference/api/python/index.md +++ b/docs/docs/reference/api/python/index.md @@ -8,7 +8,7 @@ Before you can use `dstack` Python API, ensure you have installed the `dstack` p started a `dstack` server with [configured clouds](../../docs/docs/guides/clouds.md). ```shell -pip install "dstack[all]>=0.11.2rc2" +pip install "dstack[all]==0.11.3rc1" dstack start ``` @@ -78,6 +78,9 @@ Parameters: - `project_name: Optional[str]` – (Optional) If not specified, it uses the default project. - `server_url: Optional[str]` – (Optional) The URL of the `dstack` server. Must be used with `project_name` and `user_token`. - `user_token: Optional[str]` – (Optional) The token of the `dstack` user. Must be used with `project_name` and `server_url`. + - `git_identity_file: Optional[str]` – (Optional) The path to the private SSH key file for non-public Git repositories. + - `oauth_token: Optional[str]` – (Optional) The authentication token for non-public Git repositories. + - `ssh_identity_file: Optional[str]` – (Optional) The path to the private SSH key file for SSH port forwarding. - `local_repo: bool` – (Optional) If `repo_dir` is a Git repository, `dstack` will use it as a Git repository (instead of uploading the entire contents). If you'd like to opt out from this behavior, set `local_repo` to True. It defaults to `False`. diff --git a/docs/examples/python-api.md b/docs/examples/python-api.md index 6294b9ecc..08fd0aee4 100644 --- a/docs/examples/python-api.md +++ b/docs/examples/python-api.md @@ -24,7 +24,7 @@ Before you can use `dstack` Python API, ensure you have installed the `dstack` p started a `dstack` server with [configured clouds](../../docs/docs/guides/clouds.md). ```shell -pip install "dstack[all]>=0.11.2rc2" +pip install "dstack[all]==0.11.3rc1" dstack start ```