diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 4126f68bc3e8..9e73e2ee4a87 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -1946,6 +1946,15 @@ pub struct RemoveArgs { #[arg(long, conflicts_with("dev"))] pub optional: Option, + #[command(flatten)] + pub installer: ResolverInstallerArgs, + + #[command(flatten)] + pub build: BuildArgs, + + #[command(flatten)] + pub refresh: RefreshArgs, + /// Remove the dependency from a specific package in the workspace. #[arg(long, conflicts_with = "isolated")] pub package: Option, diff --git a/crates/uv/src/commands/pip/compile.rs b/crates/uv/src/commands/pip/compile.rs index ce67844d5749..dc82c8347d3c 100644 --- a/crates/uv/src/commands/pip/compile.rs +++ b/crates/uv/src/commands/pip/compile.rs @@ -43,7 +43,7 @@ use crate::commands::ExitStatus; use crate::printer::Printer; /// Resolve a set of requirements into a set of pinned versions. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] pub(crate) async fn pip_compile( requirements: &[RequirementsSource], constraints: &[RequirementsSource], diff --git a/crates/uv/src/commands/pip/install.rs b/crates/uv/src/commands/pip/install.rs index de84e7dbf7f2..e8d16034d5f6 100644 --- a/crates/uv/src/commands/pip/install.rs +++ b/crates/uv/src/commands/pip/install.rs @@ -35,7 +35,7 @@ use crate::commands::{elapsed, ExitStatus, SharedState}; use crate::printer::Printer; /// Install packages into the current environment. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] pub(crate) async fn pip_install( requirements: &[RequirementsSource], constraints: &[RequirementsSource], diff --git a/crates/uv/src/commands/pip/list.rs b/crates/uv/src/commands/pip/list.rs index 6de58130206e..60e4055f57cf 100644 --- a/crates/uv/src/commands/pip/list.rs +++ b/crates/uv/src/commands/pip/list.rs @@ -22,7 +22,7 @@ use crate::commands::ExitStatus; use crate::printer::Printer; /// Enumerate the installed packages in the current environment. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] pub(crate) fn pip_list( editable: bool, exclude_editable: bool, diff --git a/crates/uv/src/commands/pip/sync.rs b/crates/uv/src/commands/pip/sync.rs index 7154d64bfc5f..b0aa1867a784 100644 --- a/crates/uv/src/commands/pip/sync.rs +++ b/crates/uv/src/commands/pip/sync.rs @@ -34,7 +34,7 @@ use crate::commands::{ExitStatus, SharedState}; use crate::printer::Printer; /// Install a set of locked requirements into the current Python environment. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] pub(crate) async fn pip_sync( requirements: &[RequirementsSource], constraints: &[RequirementsSource], diff --git a/crates/uv/src/commands/project/add.rs b/crates/uv/src/commands/project/add.rs index cdaeed4e571d..ea851c7fa3e6 100644 --- a/crates/uv/src/commands/project/add.rs +++ b/crates/uv/src/commands/project/add.rs @@ -23,7 +23,7 @@ use crate::printer::Printer; use crate::settings::ResolverInstallerSettings; /// Add one or more packages to the project requirements. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] pub(crate) async fn add( requirements: Vec, editable: Option, diff --git a/crates/uv/src/commands/project/remove.rs b/crates/uv/src/commands/project/remove.rs index 3a4cabaad4a9..c9757339ff73 100644 --- a/crates/uv/src/commands/project/remove.rs +++ b/crates/uv/src/commands/project/remove.rs @@ -13,7 +13,7 @@ use uv_warnings::{warn_user, warn_user_once}; use crate::commands::pip::operations::Modifications; use crate::commands::{project, ExitStatus, SharedState}; use crate::printer::Printer; -use crate::settings::{InstallerSettings, ResolverSettings}; +use crate::settings::ResolverInstallerSettings; /// Remove one or more packages from the project requirements. pub(crate) async fn remove( @@ -21,6 +21,7 @@ pub(crate) async fn remove( dependency_type: DependencyType, package: Option, python: Option, + settings: ResolverInstallerSettings, python_preference: PythonPreference, python_fetch: PythonFetch, preview: PreviewMode, @@ -94,9 +95,6 @@ pub(crate) async fn remove( ) .await?; - // Use the default settings. - let settings = ResolverSettings::default(); - // Initialize any shared state. let state = SharedState::default(); @@ -104,7 +102,7 @@ pub(crate) async fn remove( let lock = project::lock::do_lock( project.workspace(), venv.interpreter(), - settings.as_ref(), + settings.as_ref().into(), &state, preview, connectivity, @@ -117,7 +115,6 @@ pub(crate) async fn remove( // Perform a full sync, because we don't know what exactly is affected by the removal. // TODO(ibraheem): Should we accept CLI overrides for this? Should we even sync here? - let settings = InstallerSettings::default(); let extras = ExtrasSpecification::All; let dev = true; @@ -128,7 +125,7 @@ pub(crate) async fn remove( extras, dev, Modifications::Exact, - settings.as_ref(), + settings.as_ref().into(), &state, preview, connectivity, diff --git a/crates/uv/src/commands/venv.rs b/crates/uv/src/commands/venv.rs index affeb4b32e15..cb9068983859 100644 --- a/crates/uv/src/commands/venv.rs +++ b/crates/uv/src/commands/venv.rs @@ -105,7 +105,7 @@ enum VenvError { } /// Create a virtual environment. -#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)] +#[allow(clippy::fn_params_excessive_bools)] async fn venv_impl( path: &Path, python_request: Option<&str>, diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index e9d0163a793b..d19f71a30cd3 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -959,13 +959,14 @@ async fn run_project( show_settings!(args); // Initialize the cache. - let cache = cache.init()?; + let cache = cache.init()?.with_refresh(args.refresh); commands::remove( args.requirements, args.dependency_type, args.package, args.python, + args.settings, globals.python_preference, globals.python_fetch, globals.preview, diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 04ba352a6118..6ad2f23a6fab 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -565,16 +565,21 @@ pub(crate) struct RemoveSettings { pub(crate) dependency_type: DependencyType, pub(crate) package: Option, pub(crate) python: Option, + pub(crate) refresh: Refresh, + pub(crate) settings: ResolverInstallerSettings, } impl RemoveSettings { /// Resolve the [`RemoveSettings`] from the CLI and filesystem configuration. #[allow(clippy::needless_pass_by_value)] - pub(crate) fn resolve(args: RemoveArgs, _filesystem: Option) -> Self { + pub(crate) fn resolve(args: RemoveArgs, filesystem: Option) -> Self { let RemoveArgs { dev, optional, requirements, + installer, + build, + refresh, package, python, } = args; @@ -592,6 +597,11 @@ impl RemoveSettings { dependency_type, package, python, + refresh: Refresh::from(refresh), + settings: ResolverInstallerSettings::combine( + resolver_installer_options(installer, build), + filesystem, + ), } } }