Skip to content

Commit

Permalink
- [API] Added init to dstack.Client.from_config
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschmidt85 committed Sep 20, 2023
1 parent b1169f5 commit 98dfed1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cli/dstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def from_config(
oauth_token: Optional[str] = None,
ssh_identity_file: Optional[str] = None,
local_repo: bool = False,
init: bool = True,
):
if server_url is not None and user_token is not None:
if project_name is None:
Expand All @@ -335,4 +336,6 @@ 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, git_identity_file, oauth_token, ssh_identity_file)
return Client(
hub_client, repo_dir, git_identity_file, oauth_token, ssh_identity_file, init
)
5 changes: 2 additions & 3 deletions docs/docs/reference/api/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ Parameters:
- `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`.

!!! info "NOTE:"
The call of `Client.from_config()` is equal to [`dstack init`](../../cli/init.md).
- `init: bool` – (Optional) By default, `from_config()` is equivalent to [`dstack init`](../../cli/init.md). Set `init`
to `False` to skip automatic repo initialization.

### runs

Expand Down

0 comments on commit 98dfed1

Please sign in to comment.