Skip to content

Feature Request: UV Builder support for dependency groups like Pixi's .environment() #32

Description

@yzx9

The Pixi builder supports selecting named environments from pixi.toml via .environment():

Environment env = Appose.pixi("pixi.toml")
  .environment("cuda")
  .build();

This maps to pixi install -e cuda and enables optional dependency selection without modifying the manifest.

The UV builder has no equivalent. When using .content(pyprojectContent).scheme("pyproject.toml"), only [project.dependencies] is resolved. PEP 735 [dependency-groups] are ignored, so there is no way to install optional groups.

Proposed solution

Add a group(String...) method to UvBuilder that maps to uv sync --group <name>:

Environment env = Appose.uv()
  .content(pyprojectContent)
  .scheme("pyproject.toml")
  .python("3.12")
  .group("appose")       // maps to: uv sync --group appose
  .group("cuda")         // maps to: uv sync --group appose --group cuda
  .build();

This would bring UV builder to parity with Pixi builder's .environment() for optional dependency selection

If you’re interested, I can propose a PR

Current workaround

Consumers can modify the pyproject.toml content string before passing it to the builder:

String content = Files.readString(pyprojectFile.toPath());
content = content.replaceFirst("(dependencies\\s*=\\s*\\[)", "$1\"appose>=0.5.1\",");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions