Skip to content

Add support for selecting UV dependency groups during build via environment variable #1865

@alexandre-petitjean

Description

@alexandre-petitjean

Currently, the Heroku Python buildpack uses uv sync --locked --no-default-groups when installing dependencies in a non-CI build environment.
While this works for most setups, it assumes that all runtime dependencies are declared in the [project.dependencies] section.

In some cases, teams organize dependencies differently. For example, by having a prod group for runtime dependencies and a dev or local group for development tools.
With the current buildpack logic, prod is never installed because it is excluded along with dev.

I propose to use an environment variable like UV_GROUPS.

# This config
UV_GROUPS="prod,extra"

# Would give this command
uv sync --locked --no-default-groups --group prod --group extra

IfUV_GROUPS is not set, behavior remains unchanged.

If INSTALL_TEST is set (Heroku CI), the existing logic for default groups remains untouched.

I will be happy to attempt a PR if needed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions