Skip to content

migrations: switch backend migration command from uv run to python#190

Draft
jirikuncar wants to merge 1 commit into
mainfrom
jiri/migrations-drop-uv
Draft

migrations: switch backend migration command from uv run to python#190
jirikuncar wants to merge 1 commit into
mainfrom
jiri/migrations-drop-uv

Conversation

@jirikuncar

Copy link
Copy Markdown

Summary

Pairs with pydantic/platform#26663, which slims the python-prod image by dropping uv, git, and other build tooling.

The logfire-backend-migrations Job is the only place in this chart that was still calling uv run --no-sync ... — every other service template already uses python -m .... This switches the migration Job to plain python ... so it keeps working on the leaner image.

Behavior

Both invocations resolve to the same interpreter on the prod image:

  • uv run --no-sync src/packages/logfire-db/logfire_db/migrations/main.py (old)
  • python src/packages/logfire-db/logfire_db/migrations/main.py (new)

The prod image sets ENV PATH=/app/.venv/bin:$PATH, so python is /app/.venv/bin/python — the same interpreter uv run --no-sync was invoking. The migration script hasn't changed.

Coordination with the platform PR

  • Once pydantic/platform#26663 merges and a python-prod:* image is published from main, the old chart command (uv run …) will fail on that image because there is no uv binary.
  • This PR should land at or before the first chart release that pins to a main-cut python-prod image tag. Kept as draft until #26663 is merged and a tag is available.

Verification

  • Confirmed only one uv run reference exists in the chart templates (this file). Every other workload (logfire-backend, logfire-worker, logfire-remote-mcp, etc.) already uses python -m ... or a direct binary.
  • On the platform PR, ran python /app/src/packages/logfire-db/logfire_db/migrations/main.py against a locally-built python-prod image — the script enumerates all 336 migrations before hitting the DB (fails only at DB-connect, as expected).

🤖 Generated with Claude Code

Pairs with pydantic/platform#26663, which drops `uv` from the `python-prod`
image to shrink the artifact. The backend migration Job on that image is
the only in-cluster command that was still calling `uv run --no-sync ...`;
this switches it to plain `python ...`.

Both invocations are semantically identical: the prod image has the
project's venv first on `PATH` (`/app/.venv/bin`), so `python` resolves
to the venv interpreter — same as what `uv run --no-sync` was running.

Verified locally on the platform PR by importing the migration entrypoint
against the new `python-prod` image; it enumerates all 336 migrations
before hitting the DB, exactly as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants