Skip to content

build: migrate project to pyproject and uv#30

Draft
sfc-gh-bnisco wants to merge 4 commits into
mainfrom
build/uv-pyproject-migration
Draft

build: migrate project to pyproject and uv#30
sfc-gh-bnisco wants to merge 4 commits into
mainfrom
build/uv-pyproject-migration

Conversation

@sfc-gh-bnisco

@sfc-gh-bnisco sfc-gh-bnisco commented May 12, 2026

Copy link
Copy Markdown

Replace the pip + requirements.txt workflow with a uv-managed pyproject.toml and a committed uv.lock. This gives the template a single source of truth for dependencies and reproducible installs across local dev, Codespaces, and the deployed app (Streamlit Community Cloud reads uv.lock at the highest priority).

Before → After

Before After
Dependency source requirements.txt pyproject.toml + committed uv.lock
Install pip install -r requirements.txt uv sync
Run streamlit run streamlit_app.py uv run streamlit run streamlit_app.py
Python version unpinned (system / devcontainer's 3.11) >=3.11 floor, pinned via .python-version
Streamlit streamlit (unpinned, resolved 1.57.0) streamlit>=1.58.0 floor, locked to 1.58.0
Devcontainer image python:1-3.11-bullseye python:1.0-3.11-bookworm
Devcontainer env pip --user inside the workspace uv venv at $HOME/.venvs/... (off the mounted workspace)

Versioning strategy

The committed uv.lock is what makes installs reproducible: every environment resolves to the exact same dependency tree. The risk with a pinned lockfile is that it goes stale, so a Dependabot config (.github/dependabot.yml) keeps it fresh:

  • Watches the uv ecosystem and bumps uv.lock as new Streamlit and transitive releases land, so the committed lock (and the Community Cloud demo that deploys from it) tracks current versions.
  • All updates are grouped into a single daily PR to keep the noise down for a template repo.
  • Reproducibility is preserved end to end: the lock stays the single source of truth, and version bumps arrive as reviewable PRs rather than drifting silently.

Notes

  • The lockfile pins streamlit==1.58.0 and its full dependency tree, so every environment resolves identically.
  • The Python floor is kept at 3.11 so the template runs on widely-available interpreters (and the Community Cloud runtime) without forcing a newer download.
  • Verified locally: uv sync builds the env on CPython 3.11.9 with Streamlit 1.58.0, and the app imports cleanly.

sfc-gh-bnisco and others added 4 commits May 12, 2026 14:44
Replace the pip requirements workflow with a uv-managed pyproject and lockfile so the app has a single source of truth for dependencies and reproducible installs.
This also raises the Python baseline to 3.14 and updates the devcontainer to keep its container environment separate from the host workspace.

Co-authored-by: Cursor <cursoragent@cursor.com>
The migration pinned the project to Python >=3.14, which excluded users on
common interpreters (3.11-3.13) and risked the Streamlit Community Cloud
deploy target, where 3.14 may not yet be selectable. Lower the floor and the
default dev version to 3.11 so a fresh `uv sync` works on widely-available
Pythons without forcing a 3.14 download.

Set requires-python, .python-version, and the devcontainer to 3.11, and
regenerate uv.lock against the wider range. Also pin the devcontainer image
to 1.0-3.11-bookworm instead of the floating 3.14-bookworm tag, and dedent
the standalone uv-install code block in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adopt the latest Streamlit release. Add a >=1.58.0 floor to the dependency
so fresh clones pick up current fixes and features, and regenerate uv.lock
to pin streamlit==1.58.0 (up from 1.57.0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"name": "Python 3.11",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:1.0-3.11-bookworm",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why not Python 3.14?
In the description you say

The Python floor is kept at 3.11 so the template runs on widely-available interpreters (and the Community Cloud runtime) without forcing a newer download.

but CC also supports 3.14 and using the latest Python version means we don't have to force-upgrade these apps in autumn next year.

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