refactor: Run python services in place via uv run
A python-runner service ran from a tool venv (uv tool install --editable), separate from the project venv that uv sync manages. The editable link kept source live, but dependencies were resolved independently in each venv, so a new dependency landed in the project venv and never reached the running service — leaving no clean rollout for it. Deploy now emits ExecStart=uv run --project <source> --no-dev <program>, running the service in place from its own project venv. uv run syncs the env to the lockfile before launching, so a single restart picks up both code and dependency changes; the ExecStart is deterministic from source and never goes stale. The tool-venv install is gated to the command runner only; uv tool install is reserved for tool-behavior programs, where PATH is the point. A python service with no resolvable source falls back to a PATH lookup.
This commit is contained in:
@@ -199,12 +199,21 @@ Discriminated union on `runner`:
|
||||
|
||||
| Runner | Sync | Deploy | Key fields |
|
||||
|--------|------|--------|------------|
|
||||
| `python` | `uv sync` | `which(program)` → installed binary | `program`, `args` |
|
||||
| `python` | *(none — `uv run` self-syncs)* | `uv run --project <source> --no-dev <program>` | `program`, `args` |
|
||||
| `command` | *(none)* | `which(argv[0])` → resolved path | `argv` |
|
||||
| `container` | *(none)* | `docker`/`podman` `run` | `image`, `command`, `ports`, `volumes` |
|
||||
| `node` | `package_manager install` | `package_manager run script` | `script`, `package_manager` |
|
||||
| `remote` | *(none)* | *(none — no local process)* | `base_url`, `health_url` |
|
||||
|
||||
A `python` service runs **in place from its own project venv** via `uv run`, which
|
||||
syncs the env to the project's lockfile before launching. There is no separate
|
||||
tool venv and no `uv tool install` step: **a restart picks up both code and
|
||||
dependency changes** (the deploy-time `ExecStart` is deterministic from `source`,
|
||||
so it never goes stale). `uv tool install` is reserved for `tool`-behavior
|
||||
programs, where being on a human's PATH is the point. If a `python` service
|
||||
declares a `program` with no resolvable `source`, deploy falls back to a PATH
|
||||
lookup of the script.
|
||||
|
||||
```yaml
|
||||
run:
|
||||
runner: python
|
||||
|
||||
Reference in New Issue
Block a user