refactor: Update runner specifications from 'python_uv_tool' to 'python' across components and documentation

This commit is contained in:
2026-02-22 23:56:37 -08:00
parent 73e4a2ba00
commit 5e3e01a5b6
23 changed files with 539 additions and 124 deletions

View File

@@ -15,7 +15,7 @@ from castle_cli.manifest import (
ManageSpec,
PathInstallSpec,
ProxySpec,
RunPythonUvTool,
RunPython,
SystemdSpec,
ToolSpec,
)
@@ -78,8 +78,8 @@ def run_create(args: argparse.Namespace) -> int:
id=name,
description=args.description or f"A castle {proj_type}",
source=f"components/{name}",
run=RunPythonUvTool(
runner="python_uv_tool",
run=RunPython(
runner="python",
tool=name,
),
expose=ExposeSpec(

View File

@@ -174,7 +174,7 @@ def _build_deployed(
def _build_run_cmd(run: object, env: dict[str, str]) -> list[str]:
"""Build a run command list from a RunSpec."""
match run.runner:
case "python_uv_tool":
case "python":
resolved = shutil.which(run.tool)
if not resolved:
print(
@@ -185,12 +185,6 @@ def _build_run_cmd(run: object, env: dict[str, str]) -> list[str]:
if run.args:
cmd.extend(run.args)
return cmd
case "python_module":
python = run.python or shutil.which("python3") or "python3"
cmd = [python, "-m", run.module]
if run.args:
cmd.extend(run.args)
return cmd
case "command":
cmd = list(run.argv)
resolved = shutil.which(cmd[0])

View File

@@ -22,7 +22,7 @@ def _sync_cmd(manifest: ComponentManifest) -> list[str] | None:
return None
match run.runner:
case "python_uv_tool" | "python_module":
case "python":
return ["uv", "sync"]
case "node":
return [run.package_manager, "install"]
@@ -80,13 +80,14 @@ def run_sync(args: argparse.Namespace) -> int:
installed_dirs: set[Path] = set()
for name, manifest in config.components.items():
# Determine source directory — from tool.source or manifest.source
source = None
if manifest.tool and manifest.tool.source:
source = manifest.tool.source
elif manifest.run and manifest.run.runner == "python_uv_tool" and manifest.source_dir:
source = manifest.source_dir
# Install if: has install.path, or is a python runner service
if not (
(manifest.install and manifest.install.path)
or (manifest.run and manifest.run.runner == "python")
):
continue
source = manifest.source_dir
if not source:
continue

View File

@@ -23,8 +23,7 @@ from castle_core.manifest import ( # noqa: F401 — explicit re-exports for typ
RunCommand,
RunContainer,
RunNode,
RunPythonModule,
RunPythonUvTool,
RunPython,
RunRemote,
RunSpec,
SystemdSpec,

View File

@@ -20,7 +20,7 @@ def castle_root(tmp_path: Path) -> Generator[Path, None, None]:
"description": "Test service",
"source": "test-svc",
"run": {
"runner": "python_uv_tool",
"runner": "python",
"tool": "test-svc",
},
"defaults": {