Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7408ed7
Detect apps that provide a uv.lock
dominikmuellerdmde Sep 28, 2026
fef0e3d
Install dependencies from uv.lock
dominikmuellerdmde Sep 28, 2026
0fadfde
Use .python-version to select the Python version of uv apps
dominikmuellerdmde Sep 28, 2026
563dcaf
Pass package indexes from uv.lock to pip
dominikmuellerdmde Sep 28, 2026
13c9b0e
Add integration tests for uv apps
dominikmuellerdmde Sep 28, 2026
eb04932
Document uv support in README
dominikmuellerdmde Sep 28, 2026
2494acf
Match package names in requirements case-insensitively
dominikmuellerdmde Sep 28, 2026
9afebfa
Run collectstatic for apps with a generated requirements.txt
dominikmuellerdmde Sep 28, 2026
7837d67
Install uv apps with uv sync
dominikmuellerdmde Sep 28, 2026
93dd19c
Install vendored uv apps offline with hash verification
dominikmuellerdmde Sep 28, 2026
7397cdf
Extend integration tests for uv sync
dominikmuellerdmde Sep 28, 2026
926c4aa
Update README for uv sync
dominikmuellerdmde Sep 28, 2026
33e68ff
Install uv from the wheel shipped in the manifest
dominikmuellerdmde Oct 26, 2026
cab5799
Address review feedback on uv support
dominikmuellerdmde Oct 28, 2026
708baa2
Fail staging for unsupported versions in .python-version
dominikmuellerdmde Nov 4, 2026
1090b72
Install uv into a unique temporary directory
dominikmuellerdmde Nov 4, 2026
4a74f72
Share the package selection of uv export and uv sync
dominikmuellerdmde Nov 4, 2026
49ff37b
Match package names with dots and extras in requirements
dominikmuellerdmde Nov 4, 2026
533b656
Require pyproject.toml for uv apps in all supply steps
dominikmuellerdmde Nov 4, 2026
93e795f
Fail early for uv apps with an empty vendor directory
dominikmuellerdmde Nov 4, 2026
4db398c
Regenerate the uv_django lockfile with uv 0.13.5
dominikmuellerdmde Nov 4, 2026
e0e95d0
Document that uv sources cannot be vendored
dominikmuellerdmde Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ This buildpack supports running Django and Flask apps.

Official buildpack documentation can be found at [python buildpack docs](http://docs.cloudfoundry.org/buildpacks/python/index.html).

### uv

Apps managed with [uv](https://docs.astral.sh/uv/) are supported by pushing the `pyproject.toml` together with a `uv.lock`:

* During staging the buildpack runs `uv sync --frozen` to install the locked packages into the buildpack's Python installation. Every package is verified against the hashes in `uv.lock`, and staging fails on a mismatch. Keep `uv.lock` up to date (`uv lock`) before pushing, as it is used as is.
* Only the default dependencies are installed, dependency groups such as `dev` are skipped. If the project defines a `[build-system]`, the project itself is installed as well (non-editable).
* The Python version is taken from `.python-version` (e.g. `3.12`, as written by `uv python pin`), unless a `runtime.txt` exists. Only CPython versions like `3.12` or `3.12.4` are supported; staging fails for other values (e.g. `pypy@3.10` or `>=3.11`). uv never downloads its own Python; staging fails if the version does not satisfy `requires-python`.
* Package indexes configured via `[[tool.uv.index]]` are used as configured. Credentials are not part of `uv.lock`; provide them as environment variables, e.g. `cf set-env <app> UV_INDEX_<NAME>_USERNAME ...` and `UV_INDEX_<NAME>_PASSWORD`. uv trusts the system certificate store, like pip does.
* Django's `collectstatic`, as well as the installation of libffi and libmemcached, work as for pip apps. They are detected from the packages exported from `uv.lock` with the same selection as `uv sync`. Packages restricted by environment markers (e.g. `sys_platform == 'win32'`) are taken into account for detection even if their markers do not match, but are only installed if they do.
* If the app also contains a `requirements.txt`, the `uv.lock` and `.python-version` are ignored and pip is used. Both `pyproject.toml` and `uv.lock` are required for the app to be treated as a uv app.
* For vendored (offline) installs, download the wheels for the target platform into the `vendor` directory. They are installed with `uv pip install --offline` from the packages exported from `uv.lock`, which are the same packages as installed by `uv sync`, and are verified against the hashes in `uv.lock` as well. Staging fails if the `vendor` directory is empty. Write the exported file outside the app, so that it does not take precedence over `uv.lock`:

```bash
uv export --frozen --no-dev --no-hashes --no-emit-project -o /tmp/requirements.txt
pip download -r /tmp/requirements.txt -d vendor --only-binary=:all: --platform manylinux2014_x86_64 --python-version 3.12
```

If the project defines a `[build-system]`, its build backend (e.g. `hatchling`) must be vendored as well.

Vendored installs only support packages available as wheels (from PyPI or a configured package index). If the project uses `[tool.uv.sources]` overrides that point to git repositories, URLs, or local paths, those packages cannot be vendored — use the non-vendored (online) install path instead.

## Adding new dependencies

If you want to add a new dependency to the buildpack, please add it to the [config.yml](https://github.com/cloudfoundry/buildpacks-ci/blob/5a63d13df09f83d5dff7c71d0a12c3e2dc798d39/pipelines/dependency-builds/config.yml#L272) file. For example, if you want to add a new version of Python, add an entry like the following:
Expand Down
2 changes: 1 addition & 1 deletion bin/detect
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BUILD_DIR=$1
BP=$(dirname $(dirname $0))

# Exit early if app is clearly not Python.
if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ] && [ ! -f $BUILD_DIR/environment.yml ] && [ ! -f $BUILD_DIR/Pipfile ]; then
if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ] && [ ! -f $BUILD_DIR/environment.yml ] && [ ! -f $BUILD_DIR/Pipfile ] && { [ ! -f $BUILD_DIR/uv.lock ] || [ ! -f $BUILD_DIR/pyproject.toml ]; }; then
exit 1
fi

Expand Down
2 changes: 2 additions & 0 deletions fixtures/uv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
.venv
1 change: 1 addition & 0 deletions fixtures/uv/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
1 change: 1 addition & 0 deletions fixtures/uv/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn server:app
14 changes: 14 additions & 0 deletions fixtures/uv/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = "uv-app"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
"flask",
"gunicorn",
"colorama; sys_platform == 'win32'",
]

[dependency-groups]
dev = [
"pytest",
]
18 changes: 18 additions & 0 deletions fixtures/uv/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from flask import Flask

app = Flask(__name__)

port = int(os.getenv('VCAP_APP_PORT', 8080))


@app.route("/")
def hello():
return "Hello, World!"


app.debug = True

if __name__ == '__main__':
app.run(host='0.0.0.0', port=port)
Loading
Loading