llamactl 0.3.0a11__py3-none-any.whl → 0.3.0a13__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 -2
- llama_deploy/cli/app.py +3 -2
- llama_deploy/cli/client.py +26 -5
- llama_deploy/cli/commands/auth.py +382 -0
- llama_deploy/cli/commands/deployment.py +89 -38
- llama_deploy/cli/config.py +91 -23
- llama_deploy/cli/interactive_prompts/session_utils.py +37 -0
- llama_deploy/cli/interactive_prompts/utils.py +12 -37
- llama_deploy/cli/options.py +24 -1
- llama_deploy/cli/platform_client.py +52 -0
- llama_deploy/cli/textual/api_key_profile_form.py +563 -0
- llama_deploy/cli/textual/deployment_form.py +11 -10
- llama_deploy/cli/textual/deployment_monitor.py +98 -105
- llama_deploy/cli/textual/git_validation.py +11 -9
- llama_deploy/cli/textual/styles.tcss +21 -5
- {llamactl-0.3.0a11.dist-info → llamactl-0.3.0a13.dist-info}/METADATA +4 -4
- llamactl-0.3.0a13.dist-info/RECORD +29 -0
- llama_deploy/cli/commands/profile.py +0 -217
- llama_deploy/cli/textual/profile_form.py +0 -170
- llamactl-0.3.0a11.dist-info/RECORD +0 -27
- {llamactl-0.3.0a11.dist-info → llamactl-0.3.0a13.dist-info}/WHEEL +0 -0
- {llamactl-0.3.0a11.dist-info → llamactl-0.3.0a13.dist-info}/entry_points.txt +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"""Textual-based forms for CLI interactions"""
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
from textual import events
|
|
7
|
-
from textual.app import App, ComposeResult
|
|
8
|
-
from textual.containers import (
|
|
9
|
-
Container,
|
|
10
|
-
HorizontalGroup,
|
|
11
|
-
)
|
|
12
|
-
from textual.validation import Length
|
|
13
|
-
from textual.widgets import Button, Input, Label, Static
|
|
14
|
-
|
|
15
|
-
from ..config import Profile, config_manager
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@dataclass
|
|
19
|
-
class ProfileForm:
|
|
20
|
-
"""Form data for profile editing/creation"""
|
|
21
|
-
|
|
22
|
-
name: str = ""
|
|
23
|
-
api_url: str = ""
|
|
24
|
-
active_project_id: str = ""
|
|
25
|
-
existing_name: str | None = None
|
|
26
|
-
|
|
27
|
-
@classmethod
|
|
28
|
-
def from_profile(cls, profile: Profile) -> "ProfileForm":
|
|
29
|
-
"""Create form from existing profile"""
|
|
30
|
-
return cls(
|
|
31
|
-
name=profile.name,
|
|
32
|
-
api_url=profile.api_url,
|
|
33
|
-
active_project_id=profile.active_project_id or "",
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class ProfileEditApp(App[ProfileForm | None]):
|
|
38
|
-
"""Textual app for editing profiles"""
|
|
39
|
-
|
|
40
|
-
CSS_PATH = Path(__file__).parent / "styles.tcss"
|
|
41
|
-
|
|
42
|
-
def __init__(self, initial_data: ProfileForm):
|
|
43
|
-
super().__init__()
|
|
44
|
-
self.form_data = initial_data
|
|
45
|
-
|
|
46
|
-
def on_mount(self) -> None:
|
|
47
|
-
self.theme = "tokyo-night"
|
|
48
|
-
|
|
49
|
-
def on_key(self, event: events.Key) -> None:
|
|
50
|
-
"""Handle key events, including Ctrl+C"""
|
|
51
|
-
if event.key == "ctrl+c":
|
|
52
|
-
self.exit(None)
|
|
53
|
-
|
|
54
|
-
def compose(self) -> ComposeResult:
|
|
55
|
-
with Container(classes="form-container"):
|
|
56
|
-
title = "Edit Profile" if self.form_data.existing_name else "Create Profile"
|
|
57
|
-
yield Static(title, classes="primary-message")
|
|
58
|
-
yield Static("", id="error-message", classes="error-message hidden")
|
|
59
|
-
with Static(classes="two-column-form-grid"):
|
|
60
|
-
yield Label(
|
|
61
|
-
"Profile Name: *", classes="required form-label", shrink=True
|
|
62
|
-
)
|
|
63
|
-
yield Input(
|
|
64
|
-
value=self.form_data.name,
|
|
65
|
-
placeholder="Enter profile name",
|
|
66
|
-
validators=[Length(minimum=1)],
|
|
67
|
-
id="name",
|
|
68
|
-
compact=True,
|
|
69
|
-
)
|
|
70
|
-
yield Label("API URL: *", classes="required form-label", shrink=True)
|
|
71
|
-
yield Input(
|
|
72
|
-
value=self.form_data.api_url,
|
|
73
|
-
placeholder="http://prod-cloud-llama-deploy",
|
|
74
|
-
validators=[Length(minimum=1)],
|
|
75
|
-
id="api_url",
|
|
76
|
-
compact=True,
|
|
77
|
-
)
|
|
78
|
-
yield Label("Project ID:", classes="form-label", shrink=True)
|
|
79
|
-
yield Input(
|
|
80
|
-
value=self.form_data.active_project_id,
|
|
81
|
-
placeholder="Optional project ID",
|
|
82
|
-
id="project_id",
|
|
83
|
-
compact=True,
|
|
84
|
-
)
|
|
85
|
-
with HorizontalGroup(classes="button-row"):
|
|
86
|
-
yield Button("Save", variant="primary", id="save", compact=True)
|
|
87
|
-
yield Button("Cancel", variant="default", id="cancel", compact=True)
|
|
88
|
-
|
|
89
|
-
def on_button_pressed(self, event: Button.Pressed) -> None:
|
|
90
|
-
if event.button.id == "save":
|
|
91
|
-
if self._validate_form():
|
|
92
|
-
result = self._get_form_data()
|
|
93
|
-
try:
|
|
94
|
-
if result.existing_name:
|
|
95
|
-
config_manager.delete_profile(result.existing_name)
|
|
96
|
-
profile = config_manager.create_profile(
|
|
97
|
-
result.name,
|
|
98
|
-
result.api_url,
|
|
99
|
-
result.active_project_id,
|
|
100
|
-
)
|
|
101
|
-
self.exit(profile)
|
|
102
|
-
except Exception as e:
|
|
103
|
-
self._handle_error(e)
|
|
104
|
-
|
|
105
|
-
elif event.button.id == "cancel":
|
|
106
|
-
self.exit(None)
|
|
107
|
-
|
|
108
|
-
def _handle_error(self, error: Exception) -> None:
|
|
109
|
-
error_message = self.query_one("#error-message", Static)
|
|
110
|
-
error_message.update(f"Error creating profile: {error}")
|
|
111
|
-
error_message.add_class("visible")
|
|
112
|
-
|
|
113
|
-
def _validate_form(self) -> bool:
|
|
114
|
-
"""Validate required fields"""
|
|
115
|
-
name_input = self.query_one("#name", Input)
|
|
116
|
-
api_url_input = self.query_one("#api_url", Input)
|
|
117
|
-
error_message = self.query_one("#error-message", Static)
|
|
118
|
-
|
|
119
|
-
errors = []
|
|
120
|
-
|
|
121
|
-
# Clear previous error state
|
|
122
|
-
name_input.remove_class("error")
|
|
123
|
-
api_url_input.remove_class("error")
|
|
124
|
-
|
|
125
|
-
if not name_input.value.strip():
|
|
126
|
-
name_input.add_class("error")
|
|
127
|
-
errors.append("Profile name is required")
|
|
128
|
-
|
|
129
|
-
if not api_url_input.value.strip():
|
|
130
|
-
api_url_input.add_class("error")
|
|
131
|
-
errors.append("API URL is required")
|
|
132
|
-
|
|
133
|
-
if errors:
|
|
134
|
-
error_message.update("; ".join(errors))
|
|
135
|
-
error_message.add_class("visible")
|
|
136
|
-
return False
|
|
137
|
-
else:
|
|
138
|
-
error_message.update("")
|
|
139
|
-
error_message.remove_class("visible")
|
|
140
|
-
return True
|
|
141
|
-
|
|
142
|
-
def _get_form_data(self) -> ProfileForm:
|
|
143
|
-
"""Extract form data from inputs"""
|
|
144
|
-
name_input = self.query_one("#name", Input)
|
|
145
|
-
api_url_input = self.query_one("#api_url", Input)
|
|
146
|
-
project_id_input = self.query_one("#project_id", Input)
|
|
147
|
-
|
|
148
|
-
return ProfileForm(
|
|
149
|
-
name=name_input.value.strip(),
|
|
150
|
-
api_url=api_url_input.value.strip(),
|
|
151
|
-
active_project_id=project_id_input.value.strip(),
|
|
152
|
-
existing_name=self.form_data.existing_name,
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def edit_profile_form(profile: Profile) -> ProfileForm | None:
|
|
157
|
-
"""Launch profile edit form and return result"""
|
|
158
|
-
initial_data = ProfileForm.from_profile(profile)
|
|
159
|
-
initial_data.existing_name = profile.name or None
|
|
160
|
-
app = ProfileEditApp(initial_data)
|
|
161
|
-
return app.run()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def create_profile_form() -> ProfileForm | None:
|
|
165
|
-
"""Launch profile creation form and return result"""
|
|
166
|
-
return edit_profile_form(
|
|
167
|
-
Profile(
|
|
168
|
-
name="", api_url="http://prod-cloud-llama-deploy", active_project_id=None
|
|
169
|
-
)
|
|
170
|
-
)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
llama_deploy/cli/__init__.py,sha256=274c45e48048bf60668ab564ae8e7c5e6daf1d7779005f87d07ce9fa7d04936c,422
|
|
2
|
-
llama_deploy/cli/app.py,sha256=5200b4ac01b0ad0c405ce841fc01a12ed32f7b6474472f00a7d6c75fe274ea45,2324
|
|
3
|
-
llama_deploy/cli/client.py,sha256=f88cc30cf6df39fa68fb0aefe668634e4fd7216895d524b9af6f7c5727ba9da4,1510
|
|
4
|
-
llama_deploy/cli/commands/aliased_group.py,sha256=bc41007c97b7b93981217dbd4d4591df2b6c9412a2d9ed045b0ec5655ed285f2,1066
|
|
5
|
-
llama_deploy/cli/commands/deployment.py,sha256=7874f4a499ce1bfd6ae14833410cc75c4c954463d96064cfd045421358479d4c,8810
|
|
6
|
-
llama_deploy/cli/commands/init.py,sha256=51b2de1e35ff34bc15c9dfec72fbad08aaf528c334df168896d36458a4e9401c,6307
|
|
7
|
-
llama_deploy/cli/commands/profile.py,sha256=933d7a434c2684c7b47bfbd7340a09e4b34d56d20624886e15fdb4e0af97ce0b,6765
|
|
8
|
-
llama_deploy/cli/commands/serve.py,sha256=4d47850397ba172944df56a934a51bedb52403cbd3f9b000b1ced90a31c75049,2721
|
|
9
|
-
llama_deploy/cli/config.py,sha256=ebec8cf9e2112378ee6ecd626166711f3fba8cfa27cd1c931fe899c0b2a047b3,6241
|
|
10
|
-
llama_deploy/cli/debug.py,sha256=e85a72d473bbe1645eb31772f7349bde703d45704166f767385895c440afc762,496
|
|
11
|
-
llama_deploy/cli/env.py,sha256=6ebc24579815b3787829c81fd5bb9f31698a06e62c0128a788559f962b33a7af,1016
|
|
12
|
-
llama_deploy/cli/interactive_prompts/utils.py,sha256=db78eba78bf347738feb89ac3eeb77a1d11f4003980f81cf3c13842f8d41afeb,2463
|
|
13
|
-
llama_deploy/cli/options.py,sha256=e71d1a306e9e302b92ab55ace75f3a9273be267ae92a71226aac84c14271619d,823
|
|
14
|
-
llama_deploy/cli/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
|
|
15
|
-
llama_deploy/cli/textual/deployment_form.py,sha256=33d4f3f0741aeaf0072f5f91368b3c0b0456c72370b72964363240d790b3fa06,20929
|
|
16
|
-
llama_deploy/cli/textual/deployment_help.py,sha256=d43e9ff29db71a842cf8b491545763d581ede3132b8af518c73af85a40950046,2464
|
|
17
|
-
llama_deploy/cli/textual/deployment_monitor.py,sha256=a2c4e48c5494f63a2b8dcc9ab1b11b4ce50d78ef94c0f54095448ce9d01fa59b,16782
|
|
18
|
-
llama_deploy/cli/textual/git_validation.py,sha256=fcbe5477c99e8e669b31c563572d4894f61475ef7e968a59d9f172642d390cf7,13329
|
|
19
|
-
llama_deploy/cli/textual/github_callback_server.py,sha256=dc74c510f8a98ef6ffaab0f6d11c7ea86ee77ca5adbc7725a2a29112bae24191,7556
|
|
20
|
-
llama_deploy/cli/textual/llama_loader.py,sha256=33cb32a46dd40bcf889c553e44f2672c410e26bd1d4b17aa6cca6d0a5d59c2c4,1468
|
|
21
|
-
llama_deploy/cli/textual/profile_form.py,sha256=747644895774e7416620d2071f6f054b06ec8e398ac0e7649386caa2a83fe2aa,5995
|
|
22
|
-
llama_deploy/cli/textual/secrets_form.py,sha256=a43fbd81aad034d0d60906bfd917c107f9ace414648b0f63ac0b29eeba4050db,7061
|
|
23
|
-
llama_deploy/cli/textual/styles.tcss,sha256=536cec7627d2a16dd03bf25bb9b6e4d53f1e0d18272b07ec0dc3bf76b0a7c2e0,3056
|
|
24
|
-
llamactl-0.3.0a11.dist-info/WHEEL,sha256=66530aef82d5020ef5af27ae0123c71abb9261377c5bc519376c671346b12918,79
|
|
25
|
-
llamactl-0.3.0a11.dist-info/entry_points.txt,sha256=b67e1eb64305058751a651a80f2d2268b5f7046732268421e796f64d4697f83c,52
|
|
26
|
-
llamactl-0.3.0a11.dist-info/METADATA,sha256=0d3518dd292be0addfdc766e4f909810dbcae7c31db2ac9243313a774186dc97,3177
|
|
27
|
-
llamactl-0.3.0a11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|