llamactl 0.3.25__tar.gz → 0.3.27__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.
- {llamactl-0.3.25 → llamactl-0.3.27}/PKG-INFO +3 -3
- {llamactl-0.3.25 → llamactl-0.3.27}/pyproject.toml +3 -3
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/_config.py +2 -1
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/_migrations.py +59 -6
- {llamactl-0.3.25 → llamactl-0.3.27}/README.md +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/__init__.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/app.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/auth/client.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/client.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/aliased_group.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/auth.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/deployment.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/dev.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/env.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/init.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/pkg.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/commands/serve.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/auth_service.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/env_service.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/migrations/0001_init.sql +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/migrations/0002_add_auth_fields.sql +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/migrations/__init__.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/schema.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/debug.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/env.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/interactive_prompts/session_utils.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/interactive_prompts/utils.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/options.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/pkg/__init__.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/pkg/defaults.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/pkg/options.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/pkg/utils.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/py.typed +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/styles.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/deployment_form.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/deployment_help.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/deployment_monitor.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/git_validation.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/github_callback_server.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/llama_loader.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/secrets_form.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/textual/styles.tcss +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/utils/env_inject.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/utils/redact.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/utils/retry.py +0 -0
- {llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/utils/version.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: llamactl
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.27
|
|
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[client]>=0.3.
|
|
9
|
-
Requires-Dist: llama-deploy-appserver>=0.3.
|
|
8
|
+
Requires-Dist: llama-deploy-core[client]>=0.3.27,<0.4.0
|
|
9
|
+
Requires-Dist: llama-deploy-appserver>=0.3.27,<0.4.0
|
|
10
10
|
Requires-Dist: vibe-llama-core>=0.1.0
|
|
11
11
|
Requires-Dist: rich>=13.0.0
|
|
12
12
|
Requires-Dist: questionary>=2.0.0
|
|
@@ -14,7 +14,7 @@ dev = [
|
|
|
14
14
|
|
|
15
15
|
[project]
|
|
16
16
|
name = "llamactl"
|
|
17
|
-
version = "0.3.
|
|
17
|
+
version = "0.3.27"
|
|
18
18
|
description = "A command-line interface for managing LlamaDeploy projects and deployments"
|
|
19
19
|
readme = "README.md"
|
|
20
20
|
license = {text = "MIT"}
|
|
@@ -23,8 +23,8 @@ authors = [
|
|
|
23
23
|
]
|
|
24
24
|
requires-python = ">=3.10, <4"
|
|
25
25
|
dependencies = [
|
|
26
|
-
"llama-deploy-core[client]>=0.3.
|
|
27
|
-
"llama-deploy-appserver>=0.3.
|
|
26
|
+
"llama-deploy-core[client]>=0.3.27,<0.4.0",
|
|
27
|
+
"llama-deploy-appserver>=0.3.27,<0.4.0",
|
|
28
28
|
"vibe-llama-core>=0.1.0",
|
|
29
29
|
"rich>=13.0.0",
|
|
30
30
|
"questionary>=2.0.0",
|
|
@@ -76,7 +76,8 @@ class ConfigManager:
|
|
|
76
76
|
|
|
77
77
|
with sqlite3.connect(self.db_path) as conn:
|
|
78
78
|
# Apply ad-hoc SQL migrations based on PRAGMA user_version
|
|
79
|
-
|
|
79
|
+
# Pass db_path to enable file-based locking across processes
|
|
80
|
+
run_migrations(conn, self.db_path)
|
|
80
81
|
|
|
81
82
|
conn.commit()
|
|
82
83
|
|
|
@@ -6,10 +6,14 @@ Inspired by https://eskerda.com/sqlite-schema-migrations-python/
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
8
|
import logging
|
|
9
|
+
import os
|
|
9
10
|
import re
|
|
10
11
|
import sqlite3
|
|
11
12
|
import sys
|
|
13
|
+
from contextlib import contextmanager
|
|
12
14
|
from importlib import import_module, resources
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Generator
|
|
13
17
|
|
|
14
18
|
if sys.version_info >= (3, 11):
|
|
15
19
|
from importlib.resources.abc import Traversable
|
|
@@ -23,6 +27,42 @@ _MIGRATIONS_PKG = "llama_deploy.cli.config.migrations"
|
|
|
23
27
|
_USER_VERSION_PATTERN = re.compile(r"pragma\s+user_version\s*=\s*(\d+)", re.IGNORECASE)
|
|
24
28
|
|
|
25
29
|
|
|
30
|
+
def _lock_file_unix(fd: int) -> None:
|
|
31
|
+
"""Acquire exclusive lock on Unix using fcntl."""
|
|
32
|
+
import fcntl
|
|
33
|
+
|
|
34
|
+
fcntl.flock(fd, fcntl.LOCK_EX)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _unlock_file_unix(fd: int) -> None:
|
|
38
|
+
"""Release lock on Unix using fcntl."""
|
|
39
|
+
import fcntl
|
|
40
|
+
|
|
41
|
+
fcntl.flock(fd, fcntl.LOCK_UN)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@contextmanager
|
|
45
|
+
def _file_lock(lock_path: Path) -> Generator[None, None, None]:
|
|
46
|
+
"""File lock to serialize migrations across processes.
|
|
47
|
+
|
|
48
|
+
Uses fcntl.flock on Unix. On Windows, SQLite's built-in locking provides
|
|
49
|
+
sufficient protection for typical CLI usage patterns.
|
|
50
|
+
"""
|
|
51
|
+
if os.name == "nt":
|
|
52
|
+
# On Windows, rely on SQLite's own file locking
|
|
53
|
+
yield
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
lock_path.parent.mkdir(parents=True, exist_ok=True)
|
|
57
|
+
lock_file = open(lock_path, "w") # noqa: SIM115
|
|
58
|
+
try:
|
|
59
|
+
_lock_file_unix(lock_file.fileno())
|
|
60
|
+
yield
|
|
61
|
+
finally:
|
|
62
|
+
_unlock_file_unix(lock_file.fileno())
|
|
63
|
+
lock_file.close()
|
|
64
|
+
|
|
65
|
+
|
|
26
66
|
def _iter_migration_files() -> list[Traversable]:
|
|
27
67
|
"""Yield packaged SQL migration files in lexicographic order."""
|
|
28
68
|
pkg = import_module(_MIGRATIONS_PKG)
|
|
@@ -40,12 +80,8 @@ def _parse_target_version(sql_text: str) -> int | None:
|
|
|
40
80
|
return int(match.group(1)) if match else None
|
|
41
81
|
|
|
42
82
|
|
|
43
|
-
def
|
|
44
|
-
"""Apply pending migrations
|
|
45
|
-
|
|
46
|
-
Each migration file should start with a `PRAGMA user_version=N;` line.
|
|
47
|
-
Files are applied in lexicographic order and only when N > current_version.
|
|
48
|
-
"""
|
|
83
|
+
def _apply_pending_migrations(conn: sqlite3.Connection) -> None:
|
|
84
|
+
"""Apply pending migrations (internal, assumes lock is held)."""
|
|
49
85
|
cur = conn.cursor()
|
|
50
86
|
current_version_row = cur.execute("PRAGMA user_version").fetchone()
|
|
51
87
|
current_version = int(current_version_row[0]) if current_version_row else 0
|
|
@@ -68,3 +104,20 @@ def run_migrations(conn: sqlite3.Connection) -> None:
|
|
|
68
104
|
else:
|
|
69
105
|
cur.execute("COMMIT")
|
|
70
106
|
current_version = target_version
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def run_migrations(conn: sqlite3.Connection, db_path: Path | None = None) -> None:
|
|
110
|
+
"""Apply pending migrations found under the migrations package.
|
|
111
|
+
|
|
112
|
+
Each migration file should start with a `PRAGMA user_version=N;` line.
|
|
113
|
+
Files are applied in lexicographic order and only when N > current_version.
|
|
114
|
+
|
|
115
|
+
Uses a file lock to prevent concurrent migrations across processes when
|
|
116
|
+
db_path is provided.
|
|
117
|
+
"""
|
|
118
|
+
if db_path is not None:
|
|
119
|
+
lock_path = db_path.with_suffix(".db.lock")
|
|
120
|
+
with _file_lock(lock_path):
|
|
121
|
+
_apply_pending_migrations(conn)
|
|
122
|
+
else:
|
|
123
|
+
_apply_pending_migrations(conn)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/config/migrations/0002_add_auth_fields.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llamactl-0.3.25 → llamactl-0.3.27}/src/llama_deploy/cli/interactive_prompts/session_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|