diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 5758f20ed..65ac2ad0a 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -1837,15 +1837,22 @@ pub struct VenvArgs { )] pub python: Option, - // TODO(zanieb): Hide me, I do nothing. + /// Ignore virtual environments when searching for the Python interpreter. + /// + /// This is the default behavior and has no effect. #[arg( long, env = "UV_SYSTEM_PYTHON", value_parser = clap::builder::BoolishValueParser::new(), - overrides_with("no_system") + overrides_with("no_system"), + hide = true, )] pub system: bool, + /// This flag is included for compatibility only, it has no effect. + /// + /// uv will never search for interpreters in virtual environments when + /// creating a virtual environment. #[arg(long, overrides_with("system"), hide = true)] pub no_system: bool, diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 499b1bbd0..1a3bc3783 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -24,7 +24,7 @@ use uv_configuration::Concurrency; use uv_fs::CWD; use uv_requirements::RequirementsSource; use uv_settings::{Combine, FilesystemOptions}; -use uv_warnings::warn_user; +use uv_warnings::{warn_user, warn_user_once}; use uv_workspace::{DiscoveryOptions, Workspace}; use crate::commands::{ExitStatus, ToolRunCommand}; @@ -630,6 +630,14 @@ async fn run(cli: Cli) -> Result { Commands::Venv(args) => { args.compat_args.validate()?; + if args.no_system { + warn_user_once!("The `--no-system` flag has no effect, a system Python interpreter is always used in `uv venv`"); + } + + if args.system { + warn_user_once!("The `--system` flag has no effect, a system Python interpreter is always used in `uv venv`"); + } + // Resolve the settings from the command-line arguments and workspace configuration. let args = settings::VenvSettings::resolve(args, filesystem); show_settings!(args);