Include virtual environment interpreters in uv python find (#6521)

Previously, we excluded these and only looked at system interpreters.
However, it makes sense for this to match the typical Python discovery
experience. We could consider swapping the default... I'm not sure what
makes more sense. If we change the default (as written now) — this could
arguably be a breaking change.
This commit is contained in:
Zanie Blue 2024-08-23 16:06:57 -05:00 committed by GitHub
parent d1cbcb30e3
commit 6cf5d13183
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 196 additions and 8 deletions

View file

@ -3063,6 +3063,25 @@ pub struct PythonFindArgs {
/// directory or parent directories will be used.
#[arg(long, alias = "no_workspace")]
pub no_project: bool,
/// Only find system Python interpreters.
///
/// By default, uv will report the first Python interpreter it would use, including those in an
/// active virtual environment or a virtual environment in the current working directory or any
/// parent directory.
///
/// The `--system` option instructs uv to skip virtual environment Python interpreters and
/// restrict its search to the system path.
#[arg(
long,
env = "UV_SYSTEM_PYTHON",
value_parser = clap::builder::BoolishValueParser::new(),
overrides_with("no_system")
)]
pub system: bool,
#[arg(long, overrides_with("system"), hide = true)]
pub no_system: bool,
}
#[derive(Args)]