Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pip-compatible --group flag to uv pip install #11686

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Feb 21, 2025

This is a minimal redux of #10861 to be compatible with uv pip. I'm not 100% convinced the interaction with other sources is exactly what we want, but this is a good starting point.

This implements the interface described in: pypa/pip#13065 (comment)

In that interface they add --group <[path:]name> to pip install, pip download, and pip wheel. Notably we do not define uv pip download and uv pip wheel, so this PR only implements it for uv pip install.

It was previously proposed we should also support this flag for uv pip compile, which can be added trivially in this PR, but is currently not to minimize divergence.

Fixes #8590
Current punts on #8969

Comment on lines +68 to +77
// Deduplicate in a stable way to get deterministic behaviour
let deduped_paths = groups
.iter()
.map(|group| &group.path)
.collect::<BTreeSet<_>>();
group_requirements = deduped_paths
.into_iter()
.map(|path| RequirementsSource::PyprojectToml(path.to_owned()))
.collect::<Vec<_>>();
requirements = &group_requirements[..];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started doing a cleanup pass to compute a BTreeMap<PathBuf, Vec<GroupName>> that would be used by subsequent steps but it was just more code and value threading for no real benefit over the current impl that just does a filter(group.path == path) later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Install dependency groups in the uv pip interface, i.e., uv pip install --group
1 participant