You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds support for the package manager uv:
https://docs.astral.sh/uv/
And specifically uv's project mode (`uv sync`), which uses a lockfile
rather then a `requirements.txt` file:
https://docs.astral.sh/uv/guides/projects/
(While uv does have a pip compatible mode that supports requirements
files, using a lockfile is a best practice for deploying an app, and not
using one means losing most of the benefits of using uv.)
Apps must have a `pyproject.toml`, `uv.lock` and `.python-version` file
(all of which are created by default by `uv init` followed by either
`uv lock` or any of the other commands that sync/update the lockfile).
We don't support `runtime.txt` (or omitting the `.python-version` file)
when using uv, since otherwise it leads to a much worse UX in several
cases. (For example, when the `runtime.txt` version or buildpack default
version differs from `requires-python` in the `pyproject.toml` file. Or
worse, when `requires-python` happens to match the distro Python in the
underlying base image.)
For now, if a `requirements.txt`, `Pipfile` or `poetry.lock` are found,
they will take precedence over `uv.lock` for backwards compatibility
(in the future this will become a warning then an error). This means
users of the third-party `heroku-buildpack-uv` will need to remove that
buildpack in order to use the new native uv support, since it exports a
`requirements.txt` file during the build which will take precedence.
For standard (non-Heroku CI) builds, the buildpack installs dependencies
using `uv sync --locked --no-default-groups`, to ensure development/test
dependencies are not installed.
We don't use `--no-dev` instead, since that only excludes the `dev`
group, and some apps may be using other group names and have added them
to uv's `default-groups` in `pyproject.toml` so that local development
workflows work with a plain `uv sync` with no additional args. (PEP 735
doesn't actually prescribe recommended group names, and in fact uses
`test` in its example rather than `dev`, so non-standard names may be
common.)
For Heroku CI builds, the buildpack installs dependencies using
`uv sync --locked`, which will install all default groups. See:
https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups
For now, we don't expose user provided env vars to `uv sync` (similar to
the behaviour for other package managers), however, will start doing so
as part of addressing #1451 and #1700.
uv is installed into the build cache rather than the slug, so is not
available at run-time (since it's not typically needed at run-time and
doing so reduces the slug size). Both Python and the entrypoints of
installed dependencies are available on `PATH`, so use of `uv run` is
not required at run-time to use dependencies in the environment.
Closes#1616.
GUS-W-17310796.
0 commit comments