llamactl 0.2.7a1__tar.gz → 0.3.0a1__tar.gz

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.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: llamactl
3
- Version: 0.2.7a1
3
+ Version: 0.3.0a1
4
4
  Summary: A command-line interface for managing LlamaDeploy projects and deployments
5
5
  Author: Adrian Lyjak
6
6
  Author-email: Adrian Lyjak <adrianlyjak@gmail.com>
7
7
  License: MIT
8
- Requires-Dist: llama-deploy-core>=0.2.7a1,<0.3.0
9
- Requires-Dist: llama-deploy-appserver>=0.2.7a1,<0.3.0
8
+ Requires-Dist: llama-deploy-core>=0.3.0a1,<0.4.0
9
+ Requires-Dist: llama-deploy-appserver>=0.3.0a1,<0.4.0
10
10
  Requires-Dist: httpx>=0.24.0
11
11
  Requires-Dist: rich>=13.0.0
12
12
  Requires-Dist: questionary>=2.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "llamactl"
3
- version = "0.2.7a1"
3
+ version = "0.3.0a1"
4
4
  description = "A command-line interface for managing LlamaDeploy projects and deployments"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -9,8 +9,8 @@ authors = [
9
9
  ]
10
10
  requires-python = ">=3.12, <4"
11
11
  dependencies = [
12
- "llama-deploy-core>=0.2.7a1,<0.3.0",
13
- "llama-deploy-appserver>=0.2.7a1,<0.3.0",
12
+ "llama-deploy-core>=0.3.0a1,<0.4.0",
13
+ "llama-deploy-appserver>=0.3.0a1,<0.4.0",
14
14
  "httpx>=0.24.0",
15
15
  "rich>=13.0.0",
16
16
  "questionary>=2.0.0",
@@ -1,16 +1,13 @@
1
- import os
2
- import subprocess
3
1
  from pathlib import Path
4
2
  from typing import Optional
5
3
 
6
4
  import click
7
- from llama_deploy.appserver.client import Client as ApiserverClient
5
+ from llama_deploy.appserver.app import start_server
8
6
  from llama_deploy.core.config import DEFAULT_DEPLOYMENT_FILE_PATH
9
7
  from llama_deploy.core.schema.deployments import DeploymentUpdate
10
8
  from rich import print as rprint
11
9
  from rich.console import Console
12
10
  from rich.table import Table
13
- from tenacity import RetryError, Retrying, stop_after_attempt, wait_fixed
14
11
 
15
12
  from .client import get_client
16
13
  from .config import config_manager
@@ -493,54 +490,42 @@ def refresh_deployment(deployment_id: Optional[str]) -> None:
493
490
  default=DEFAULT_DEPLOYMENT_FILE_PATH,
494
491
  type=click.Path(dir_okay=False, resolve_path=True, path_type=Path), # type: ignore
495
492
  )
493
+ @click.option(
494
+ "--no-install", is_flag=True, help="Skip installing python and js dependencies"
495
+ )
496
+ @click.option(
497
+ "--no-reload", is_flag=True, help="Skip reloading the API server on code changes"
498
+ )
499
+ @click.option("--no-open-browser", is_flag=True, help="Skip opening the browser")
500
+ @click.option(
501
+ "--preview",
502
+ is_flag=True,
503
+ help="Preview mode pre-builds the UI to static files, like a production build",
504
+ )
496
505
  @global_options
497
- def serve(deployment_file: Path) -> None:
506
+ def serve(
507
+ deployment_file: Path,
508
+ no_install: bool,
509
+ no_reload: bool,
510
+ no_open_browser: bool,
511
+ preview: bool,
512
+ ) -> None:
498
513
  """Run llama_deploy API Server in the foreground. If no deployment_file is provided, will look for a llama_deploy.yaml in the current directory."""
499
514
  if not deployment_file.exists():
500
515
  rprint(f"[red]Deployment file '{deployment_file}' not found[/red]")
501
516
  raise click.Abort()
502
517
 
503
518
  try:
504
- env = os.environ.copy()
505
- env["LLAMA_DEPLOY_APISERVER_DEPLOYMENTS_PATH"] = str(deployment_file.parent)
506
-
507
- client = ApiserverClient()
508
-
509
- uvicorn_p = subprocess.Popen(
510
- [
511
- "uvicorn",
512
- "llama_deploy.appserver.app:app",
513
- "--host",
514
- "localhost",
515
- "--port",
516
- "4501",
517
- ],
518
- env=env,
519
+ start_server(
520
+ cwd=deployment_file.parent,
521
+ deployment_file=deployment_file,
522
+ proxy_ui=not preview,
523
+ reload=not no_reload,
524
+ install=not no_install,
525
+ build=preview,
526
+ open_browser=not no_open_browser,
519
527
  )
520
528
 
521
- retrying = Retrying(
522
- stop=stop_after_attempt(5), wait=wait_fixed(RETRY_WAIT_SECONDS)
523
- )
524
- try:
525
- for attempt in retrying:
526
- with attempt:
527
- client.sync.apiserver.deployments.create(
528
- deployment_file.open("rb"),
529
- base_path=deployment_file.parent,
530
- local=True,
531
- )
532
- except RetryError as e:
533
- uvicorn_p.terminate()
534
- last: Optional[BaseException] = e.last_attempt.exception(0)
535
- last_msg = ""
536
- if last is not None:
537
- last_msg = ": " + (
538
- str(last.message) if hasattr(last, "message") else str(last)
539
- )
540
- raise click.ClickException(f"Failed to create deployment{last_msg}")
541
-
542
- uvicorn_p.wait()
543
-
544
529
  except KeyboardInterrupt:
545
530
  print("Shutting down...")
546
531
 
@@ -361,7 +361,6 @@ class DeploymentEditApp(App[DeploymentResponse | None]):
361
361
  def on_validation_cancel_message(self, message: ValidationCancelMessage) -> None:
362
362
  """Handle validation cancellation from git validation widget"""
363
363
  # Return to form, clearing any save error
364
- print("DEBUG: on_validation_cancel_message")
365
364
  self.save_error = ""
366
365
  self.current_state = "form"
367
366
 
@@ -206,7 +206,6 @@ class GitValidationWidget(Widget):
206
206
  yield Button(
207
207
  "Continue", id="continue_success", variant="primary", compact=True
208
208
  )
209
- print("DEBUG: render cancel button")
210
209
  # Always show cancel button
211
210
  yield Button("Back to Edit", id="cancel", variant="default", compact=True)
212
211
 
@@ -238,7 +237,6 @@ class GitValidationWidget(Widget):
238
237
  )
239
238
  self.post_message(ValidationResultMessage(self.repo_url, pat_to_send))
240
239
  elif event.button.id == "cancel":
241
- print("DEBUG: cancel button pressed")
242
240
  self.post_message(ValidationCancelMessage())
243
241
 
244
242
  def _start_github_auth(self) -> None:
File without changes