mirror of https://github.com/astral-sh/uv
fix `--only-group` in `uv pip` interface (#10902)
This was an oversight in the implementation, thankfully it appears to be a simple fix? (My only hesitation is this implementation essentially claims that --only-group is defacto incompatible with --extra and I *think* that's the case but I'm not certain.)
This commit is contained in:
parent
8ce0736f9e
commit
214494149c
|
|
@ -98,16 +98,21 @@ impl<'a, Context: BuildContext> SourceTreeResolver<'a, Context> {
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
// Flatten any transitive extras.
|
let mut requirements = Vec::new();
|
||||||
let mut requirements =
|
|
||||||
FlatRequiresDist::from_requirements(metadata.requires_dist, &metadata.name)
|
// Flatten any transitive extras and include dependencies
|
||||||
.into_iter()
|
// (unless something like --only-group was passed)
|
||||||
.map(|requirement| Requirement {
|
if self.groups.prod() {
|
||||||
origin: Some(origin.clone()),
|
requirements.extend(
|
||||||
marker: requirement.marker.simplify_extras(&extras),
|
FlatRequiresDist::from_requirements(metadata.requires_dist, &metadata.name)
|
||||||
..requirement
|
.into_iter()
|
||||||
})
|
.map(|requirement| Requirement {
|
||||||
.collect::<Vec<_>>();
|
origin: Some(origin.clone()),
|
||||||
|
marker: requirement.marker.simplify_extras(&extras),
|
||||||
|
..requirement
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply dependency-groups
|
// Apply dependency-groups
|
||||||
for (group_name, group) in &metadata.dependency_groups {
|
for (group_name, group) in &metadata.dependency_groups {
|
||||||
|
|
|
||||||
|
|
@ -14481,11 +14481,9 @@ fn dependency_group() -> Result<()> {
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --only-group bar
|
# uv pip compile --cache-dir [CACHE_DIR] pyproject.toml --only-group bar
|
||||||
iniconfig==2.0.0
|
iniconfig==2.0.0
|
||||||
typing-extensions==4.10.0
|
|
||||||
# via project (pyproject.toml)
|
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
context = new_context()?;
|
context = new_context()?;
|
||||||
|
|
|
||||||
|
|
@ -8425,11 +8425,10 @@ fn dependency_group() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
Prepared 2 packages in [TIME]
|
Prepared 1 package in [TIME]
|
||||||
Installed 2 packages in [TIME]
|
Installed 1 package in [TIME]
|
||||||
+ iniconfig==2.0.0
|
+ iniconfig==2.0.0
|
||||||
+ typing-extensions==4.10.0
|
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
context = new_context()?;
|
context = new_context()?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue