Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Feature Proposal: PEP 735 "Dependency Groups" Support #12963

Copy link
Copy link
Closed
@sirosen

Description

@sirosen
Issue body actions

What's the problem this feature will solve?

"Dependency Groups" are proposed in PEP 735 with a variety of target use cases.

In particular, the --only-deps use cases are explicitly a target for this PEP, but additional cases are listed and relevant.

Describe the solution you'd like

As the PEP author, I would like to start discussing what form, in terms of interface and implementation, pip support would take.
I would like to agree on a potential implementation path, implement it in a draft PR, and leave it pending until the PEP is accepted.

My proposal is:

  • a variant of the DependencyGroupResolver I wrote moves in-tree here, along with appropriate unit tests
  • a new CLI option is added to pip install, --dependency-groups, which takes a comma-delimited list of group names and attempts to resolve and install all of them from pyproject.toml in the current working directory

For example,

# in pyproject.toml
[dependency-groups]
test = ["pytest"]
typing = ["pyright"]

# on the CLI
pip install --dependency-groups test,typing

# equivalent to
pip install pytest pyright

Would the pip maintainers be amenable to this addition? Is there an alternative, similar strategy which I could implement?

Alternative Solutions

If pip does not gain support for Dependency Groups, it is possible to workaround the gap.
Primarily, external tooling like dependency-groups can be used to resolve groups and pass them to pip.

For example, in a *nix environment, the following usage covers most cases:

groups=$(python -m dependency_groups pytest typing | tr '\n' ' ')
pip install $groups

However, such usages will always be workarounds. pip support provides a superior developer experience.

Additional context

PEP 735 is in Draft, and will be submitted soon. At time of writing, it is not final or accepted, but no further changes to the contents are planned.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.