Skip to content

Commit 7d67c67

Browse files
committed
fix(deps): drop requirements.txt, let Heroku's buildpack use uv.lock natively
heroku/heroku-buildpack-python detects the package manager by looking for exactly one of requirements.txt, poetry.lock or uv.lock at the repo root, and now hard-fails the build ("Multiple Python package manager files were found") if it sees more than one — this stopped being just a deprecation warning. Committing both uv.lock and a uv-export-generated requirements.txt (as the previous commit did) would have broken every Heroku deploy. The buildpack has native uv support: it runs `uv sync --locked --no-default-groups` against the slug's system Python, so no requirements.txt is needed at all. Verified locally with `UV_PROJECT_ENVIRONMENT=<tmp> uv sync --locked --no-default-groups` (dev group correctly excluded) and `manage.py check --settings=pythonie.settings.production` against that environment. Drops the now-pointless `dependencies:export` / `deps:export` tasks and the requirements.txt mentions in CLAUDE.md/DEVELOPMENT.md, and documents the "never commit a requirements.txt here" constraint directly so it isn't reintroduced later. `.python-version` (already present, Python 3.13) continues to pin the buildpack's Python version. Caught by an independent review pass (h/t python-validator).
1 parent f43939e commit 7d67c67

5 files changed

Lines changed: 9 additions & 214 deletions

File tree

‎CLAUDE.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ task code:check
125125

126126
### Dependency Management
127127

128-
Uses `uv` for fast Python package management. Dependencies are declared in `pyproject.toml` (`[project.dependencies]` + `[dependency-groups]`) and locked in `uv.lock` (committed). A `requirements.txt` is generated at the repo root purely for Heroku's buildpack — it is never edited by hand.
128+
Uses `uv` for fast Python package management. Dependencies are declared in `pyproject.toml` (`[project.dependencies]` + `[dependency-groups]`) and locked in `uv.lock` (committed). Heroku's Python buildpack detects `uv.lock` and installs natively via `uv sync` against the slug's system Python — **never add a `requirements.txt` at the repo root**, the buildpack aborts the build if it finds more than one package-manager file (`requirements.txt`, `poetry.lock`, `uv.lock`) at once. `.python-version` (not `runtime.txt`, which is deprecated) pins the Python version for the buildpack.
129129

130130
```bash
131131
# Recompute the lock file
@@ -149,9 +149,6 @@ task dependencies:security
149149

150150
# Show dependencies tree
151151
task dependencies:tree
152-
153-
# Regenerate requirements.txt for Heroku
154-
task dependencies:export
155152
```
156153

157154
### Database Operations (Heroku)

‎DEVELOPMENT.md‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,16 @@ AWS_STORAGE_BUCKET_NAME=your-bucket-name
450450
```
451451
pyproject.toml # [project.dependencies] + [dependency-groups] (dev)
452452
uv.lock # Locked, resolved versions (committed)
453-
requirements.txt # Generated via `task dependencies:export`, for Heroku only
453+
.python-version # Pins the Python version for Heroku's buildpack
454454
```
455455

456+
Heroku's Python buildpack detects `uv.lock` and installs dependencies
457+
natively via `uv sync --locked --no-default-groups` against the slug's
458+
system Python — there is no separate `requirements.txt` to keep in
459+
sync. Do **not** add a `requirements.txt` at the repo root: the
460+
buildpack refuses to build if it finds more than one package-manager
461+
file (`requirements.txt`, `poetry.lock`, `uv.lock`) at once.
462+
456463
**Commands**:
457464
```bash
458465
# Recompute the lock file
@@ -475,9 +482,6 @@ task dependencies:security
475482

476483
# Show dependencies tree
477484
task dependencies:tree
478-
479-
# Regenerate requirements.txt for Heroku
480-
task dependencies:export
481485
```
482486

483487
**Manual process**:

‎Taskfile.yaml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ tasks:
190190
cmds:
191191
- toast deps:tree
192192

193-
dependencies:export:
194-
desc: Export the uv.lock to requirements.txt for Heroku deployment
195-
cmds:
196-
- toast deps:export
197-
198193
docker:build:
199194
desc: Build the docker image
200195
cmds:

‎requirements.txt‎

Lines changed: 0 additions & 193 deletions
This file was deleted.

‎toast.yml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ tasks:
5050
cache: false
5151
command: uv tree
5252

53-
deps:export:
54-
description: Export the uv.lock to requirements.txt for Heroku deployment
55-
cache: false
56-
mount_paths:
57-
- .:/app
58-
location: /app
59-
command: uv export --no-dev --no-hashes --format requirements.txt -o requirements.txt
60-
6153
code:format:
6254
description: Format the code
6355
cache: false

0 commit comments

Comments
 (0)