Skip to content

Disable dependency groups via environment variable #11619

@abhiaagarwal

Description

@abhiaagarwal

Summary

uv currently doesn't have a way to disable dependency groups via env variable. @zanieb proposed something like UV_NO_DEV in the linked bug below, It would be nice if this could be generalized to instead be something like UV_EXCLUDE_GROUPS, where the groups can be comma-separated. This has an advantage in a docker-based environment — by using an ARG + ENV combo, I can build multiple versions of a docker image, such as one with dev dependencies, or one with GPU dependencies.

I guess there's an argument that all of group-picking behavior including whitelisting should be controllable via an env variable, but that feels like it might cause weird hierarchy issues.

astral-sh/uv-docker-example#36

Example

ARG UV_EXCLUDE_GROUPS=dev
ENV UV_EXCLUDE_GROUPS=${UV_EXCLUDE_GROUPS}

 # implies --no-group dev => --no-dev
uv sync ...

# ... I can build an image excluding gpu dependencies by passing `--build-arg UV_EXCLUDE_GROUPS=dev,gpu`

Metadata

Metadata

Assignees

Labels

configurationSettings and suchenhancementNew feature or improvement to existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions