llamactl 0.3.0a13__py3-none-any.whl → 0.3.0a15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llama_deploy/cli/__init__.py +2 -1
- llama_deploy/cli/app.py +4 -7
- llama_deploy/cli/client.py +18 -32
- llama_deploy/cli/commands/auth.py +230 -235
- llama_deploy/cli/commands/deployment.py +24 -36
- llama_deploy/cli/commands/env.py +206 -0
- llama_deploy/cli/config/_config.py +385 -0
- llama_deploy/cli/config/auth_service.py +68 -0
- llama_deploy/cli/config/env_service.py +64 -0
- llama_deploy/cli/config/schema.py +31 -0
- llama_deploy/cli/interactive_prompts/utils.py +0 -39
- llama_deploy/cli/options.py +0 -9
- {llamactl-0.3.0a13.dist-info → llamactl-0.3.0a15.dist-info}/METADATA +3 -3
- {llamactl-0.3.0a13.dist-info → llamactl-0.3.0a15.dist-info}/RECORD +16 -13
- llama_deploy/cli/config.py +0 -241
- llama_deploy/cli/textual/api_key_profile_form.py +0 -563
- {llamactl-0.3.0a13.dist-info → llamactl-0.3.0a15.dist-info}/WHEEL +0 -0
- {llamactl-0.3.0a13.dist-info → llamactl-0.3.0a15.dist-info}/entry_points.txt +0 -0
llama_deploy/cli/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from llama_deploy.cli.commands.auth import auth
|
|
2
2
|
from llama_deploy.cli.commands.deployment import deployments
|
|
3
|
+
from llama_deploy.cli.commands.env import env_group
|
|
3
4
|
from llama_deploy.cli.commands.init import init
|
|
4
5
|
from llama_deploy.cli.commands.serve import serve
|
|
5
6
|
|
|
@@ -11,7 +12,7 @@ def main() -> None:
|
|
|
11
12
|
app()
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
__all__ = ["app", "deployments", "auth", "serve", "init"]
|
|
15
|
+
__all__ = ["app", "deployments", "auth", "serve", "init", "env_group"]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
if __name__ == "__main__":
|
llama_deploy/cli/app.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import asyncio
|
|
2
1
|
from importlib.metadata import PackageNotFoundError
|
|
3
2
|
from importlib.metadata import version as pkg_version
|
|
4
3
|
|
|
5
4
|
import click
|
|
6
|
-
from llama_deploy.cli.client import get_control_plane_client
|
|
7
5
|
from llama_deploy.cli.commands.aliased_group import AliasedGroup
|
|
8
|
-
from llama_deploy.cli.config import
|
|
6
|
+
from llama_deploy.cli.config.env_service import service
|
|
9
7
|
from llama_deploy.cli.options import global_options
|
|
10
8
|
from rich import print as rprint
|
|
11
9
|
from rich.console import Console
|
|
@@ -23,11 +21,10 @@ def print_version(ctx: click.Context, param: click.Option, value: bool) -> None:
|
|
|
23
21
|
console.print(Text.assemble("client version: ", (ver, "green")))
|
|
24
22
|
|
|
25
23
|
# If there is an active profile, attempt to query server version
|
|
26
|
-
|
|
27
|
-
if
|
|
24
|
+
auth_service = service.current_auth_service()
|
|
25
|
+
if auth_service:
|
|
28
26
|
try:
|
|
29
|
-
|
|
30
|
-
data = asyncio.run(cp_client.server_version())
|
|
27
|
+
data = auth_service.fetch_server_version()
|
|
31
28
|
server_ver = data.version
|
|
32
29
|
console.print(
|
|
33
30
|
Text.assemble(
|
llama_deploy/cli/client.py
CHANGED
|
@@ -1,46 +1,32 @@
|
|
|
1
1
|
from contextlib import asynccontextmanager
|
|
2
2
|
from typing import AsyncGenerator
|
|
3
3
|
|
|
4
|
-
from llama_deploy.cli.config import
|
|
4
|
+
from llama_deploy.cli.config.env_service import service
|
|
5
5
|
from llama_deploy.core.client.manage_client import ControlPlaneClient, ProjectClient
|
|
6
6
|
from rich import print as rprint
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def get_control_plane_client(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
resolved_base_url =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def get_project_client(
|
|
26
|
-
base_url: str | None = None,
|
|
27
|
-
project_id: str | None = None,
|
|
28
|
-
api_key: str | None = None,
|
|
29
|
-
) -> ProjectClient:
|
|
30
|
-
profile = config_manager.get_current_profile()
|
|
9
|
+
def get_control_plane_client() -> ControlPlaneClient:
|
|
10
|
+
profile = service.current_auth_service().get_current_profile()
|
|
11
|
+
if profile:
|
|
12
|
+
resolved_base_url = profile.api_url.rstrip("/")
|
|
13
|
+
resolved_api_key = profile.api_key
|
|
14
|
+
return ControlPlaneClient(resolved_base_url, resolved_api_key)
|
|
15
|
+
|
|
16
|
+
# Fallback: allow env-scoped client construction for env operations
|
|
17
|
+
env = service.get_current_environment()
|
|
18
|
+
resolved_base_url = env.api_url.rstrip("/")
|
|
19
|
+
return ControlPlaneClient(resolved_base_url, None)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_project_client() -> ProjectClient:
|
|
23
|
+
profile = service.current_auth_service().get_current_profile()
|
|
31
24
|
if not profile:
|
|
32
25
|
rprint("\n[bold red]No profile configured![/bold red]")
|
|
33
26
|
rprint("\nTo get started, create a profile with:")
|
|
34
|
-
rprint("[cyan]llamactl
|
|
27
|
+
rprint("[cyan]llamactl auth token[/cyan]")
|
|
35
28
|
raise SystemExit(1)
|
|
36
|
-
|
|
37
|
-
if not resolved_base_url:
|
|
38
|
-
raise ValueError("API URL is required")
|
|
39
|
-
resolved_project_id = project_id or profile.project_id
|
|
40
|
-
if not resolved_project_id:
|
|
41
|
-
raise ValueError("Project ID is required")
|
|
42
|
-
resolved_api_key = api_key or profile.api_key_auth_token
|
|
43
|
-
return ProjectClient(resolved_base_url, resolved_project_id, resolved_api_key)
|
|
29
|
+
return ProjectClient(profile.api_url, profile.project_id, profile.api_key)
|
|
44
30
|
|
|
45
31
|
|
|
46
32
|
@asynccontextmanager
|