Skip to content

Commit 9904c47

Browse files
Respect default extras in uv remove (#13380)
## Summary Using "all extras" in `uv remove` will cause errors for projects with conflicting extras. Now that we have a concept of "default extras", it seems better to respect those defaults like we do for dependency groups. Closes #12770.
1 parent d4e8df9 commit 9904c47

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

crates/uv/src/commands/project/remove.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,6 @@ pub(crate) async fn remove(
312312
return Ok(ExitStatus::Success);
313313
};
314314

315-
// Perform a full sync, because we don't know what exactly is affected by the removal.
316-
// TODO(ibraheem): Should we accept CLI overrides for this? Should we even sync here?
317-
let extras = ExtrasSpecification::from_all_extras();
318-
let install_options = InstallOptions::default();
319-
320315
// Determine the default groups to include.
321316
let default_groups = default_dependency_groups(project.pyproject_toml())?;
322317

@@ -341,10 +336,10 @@ pub(crate) async fn remove(
341336
match project::sync::do_sync(
342337
target,
343338
venv,
344-
&extras.with_defaults(default_extras),
339+
&ExtrasSpecification::default().with_defaults(default_extras),
345340
&DependencyGroups::default().with_defaults(default_groups),
346341
EditableMode::Editable,
347-
install_options,
342+
InstallOptions::default(),
348343
Modifications::Exact,
349344
(&settings).into(),
350345
&network_settings,

crates/uv/tests/it/edit.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,12 +1457,7 @@ fn add_remove_inline_optional() -> Result<()> {
14571457
14581458
----- stderr -----
14591459
Resolved 4 packages in [TIME]
1460-
Prepared 3 packages in [TIME]
14611460
Uninstalled 1 package in [TIME]
1462-
Installed 3 packages in [TIME]
1463-
+ anyio==3.7.0
1464-
+ idna==3.6
1465-
+ sniffio==1.3.1
14661461
- typing-extensions==4.10.0
14671462
");
14681463

@@ -11795,8 +11790,12 @@ fn add_optional_normalize() -> Result<()> {
1179511790
1179611791
----- stderr -----
1179711792
Resolved 5 packages in [TIME]
11798-
Uninstalled 1 package in [TIME]
11793+
Uninstalled 5 packages in [TIME]
11794+
- anyio==3.7.0
11795+
- idna==3.6
1179911796
- iniconfig==2.0.0
11797+
- sniffio==1.3.1
11798+
- typing-extensions==4.10.0
1180011799
");
1180111800

1180211801
let pyproject_toml = context.read("pyproject.toml");
@@ -11824,8 +11823,7 @@ fn add_optional_normalize() -> Result<()> {
1182411823
1182511824
----- stderr -----
1182611825
Resolved 4 packages in [TIME]
11827-
Uninstalled 1 package in [TIME]
11828-
- typing-extensions==4.10.0
11826+
Audited in [TIME]
1182911827
");
1183011828

1183111829
let pyproject_toml = context.read("pyproject.toml");

0 commit comments

Comments
 (0)