From 36b2f4d66d0b3b4ef30581af83265d53c73383fb Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 25 Jul 2024 20:14:12 -0400 Subject: [PATCH] Deprecate the --isolated flag --- crates/uv-cli/src/lib.rs | 2 +- crates/uv/src/lib.rs | 9 +++++++++ crates/uv/tests/help.rs | 29 ----------------------------- crates/uv/tests/init.rs | 1 + 4 files changed, 11 insertions(+), 30 deletions(-) diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index c18ba64a7fcc7..a35e3cdc28216 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -154,7 +154,7 @@ pub struct GlobalArgs { /// Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any /// parent directories. - #[arg(global = true, long)] + #[arg(global = true, long, hide = true)] pub isolated: bool, /// Show the resolved settings for the current command. diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index db013a68b9156..6fb32b608871b 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -23,6 +23,7 @@ use uv_cli::{SelfCommand, SelfNamespace}; use uv_configuration::Concurrency; use uv_requirements::RequirementsSource; use uv_settings::{Combine, FilesystemOptions}; +use uv_warnings::warn_user; use uv_workspace::{DiscoveryOptions, Workspace}; use crate::commands::{ExitStatus, ToolRunCommand}; @@ -136,6 +137,14 @@ async fn run(cli: Cli) -> Result { ) }))?; + if globals.isolated { + if globals.preview.is_enabled() { + warn_user!("The `--isolated` flag is deprecated. Instead, use `--no-config` to prevent uv from discovering configuration files, or `--no-workspace` to prevent uv from discovering a workspace in `uv run` and other commands."); + } else { + warn_user!("The `--isolated` flag is deprecated. Instead, use `--no-config` to prevent uv from discovering configuration files."); + } + } + debug!("uv {}", version::version()); // Write out any resolved settings. diff --git a/crates/uv/tests/help.rs b/crates/uv/tests/help.rs index ae95fa5834f48..3178c148dd5a0 100644 --- a/crates/uv/tests/help.rs +++ b/crates/uv/tests/help.rs @@ -43,9 +43,6 @@ fn help() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -109,9 +106,6 @@ fn help_flag() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -174,9 +168,6 @@ fn help_short_flag() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -280,10 +271,6 @@ fn help_subcommand() { - manual: Do not automatically fetch managed Python installations; require explicit installation - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories - --no-progress Hides all progress outputs when set @@ -408,10 +395,6 @@ fn help_subsubcommand() { - manual: Do not automatically fetch managed Python installations; require explicit installation - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories - --no-progress Hides all progress outputs when set @@ -490,9 +473,6 @@ fn help_flag_subcommand() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -552,9 +532,6 @@ fn help_flag_subsubcommand() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -671,9 +648,6 @@ fn help_with_global_option() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache @@ -770,9 +744,6 @@ fn test_with_no_pager() { --python-fetch Whether to automatically download Python when required [possible values: automatic, manual] - --isolated - Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - parent directories --no-progress Hides all progress outputs when set -n, --no-cache diff --git a/crates/uv/tests/init.rs b/crates/uv/tests/init.rs index 55ebd47308bca..3338c1f9db3fe 100644 --- a/crates/uv/tests/init.rs +++ b/crates/uv/tests/init.rs @@ -580,6 +580,7 @@ fn init_isolated() -> Result<()> { ----- stdout ----- ----- stderr ----- + warning: The `--isolated` flag is deprecated. Instead, use `--no-config` to prevent uv from discovering configuration files. warning: `uv init` is experimental and may change without warning Initialized project `foo` "###);