Skip to content

Commit

Permalink
Add --no-config to replace --isolated (#5463)
Browse files Browse the repository at this point in the history
## Summary

I'll deprecate `--isolated` separately, since it _is_ still used for
some other behaviors.

Closes #5428.
  • Loading branch information
charliermarsh authored Jul 25, 2024
1 parent 8cb22f5 commit d51b429
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@ uv accepts the following command-line arguments as environment variables:
will use this value as the keyring provider.
- `UV_CONFIG_FILE`: Equivalent to the `--config-file` command-line argument. Expects a path to a
local `uv.toml` file to use as the configuration file.
- `UV_NO_CONFIG`: Equivalent to the `--no-config` command-line argument. If set, uv will not read
any configuration files from the current directory, parent directories, or user configuration
directories.
- `UV_CONCURRENT_DOWNLOADS`: Sets the maximum number of in-flight concurrent downloads that `uv`
will perform at any given time.
- `UV_CONCURRENT_BUILDS`: Sets the maximum number of source distributions that `uv` will build
Expand Down
5 changes: 5 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ pub struct Cli {
#[arg(global = true, long, env = "UV_CONFIG_FILE")]
pub config_file: Option<PathBuf>,

/// Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current directory,
/// parent directories, or user configuration directories.
#[arg(global = true, long, env = "UV_NO_CONFIG", value_parser = clap::builder::BoolishValueParser::new())]
pub no_config: bool,

/// Print help.
#[arg(global = true, short, long, action = clap::ArgAction::HelpShort)]
help: Option<bool>,
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
// search for `pyproject.toml` files, since we're not in a workspace.
let filesystem = if let Some(config_file) = cli.config_file.as_ref() {
Some(FilesystemOptions::from_file(config_file)?)
} else if cli.global_args.isolated {
} else if cli.global_args.isolated || cli.no_config {
None
} else if let Ok(project) =
Workspace::discover(&std::env::current_dir()?, &DiscoveryOptions::default()).await
Expand Down
33 changes: 33 additions & 0 deletions crates/uv/tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ fn help() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -118,6 +121,9 @@ fn help_flag() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -180,6 +186,9 @@ fn help_short_flag() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -297,6 +306,12 @@ fn help_subcommand() {
[env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories
[env: UV_NO_CONFIG=]
-h, --help
Print help
Expand Down Expand Up @@ -419,6 +434,12 @@ fn help_subsubcommand() {
[env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories
[env: UV_NO_CONFIG=]
-h, --help
Print help
Expand Down Expand Up @@ -481,6 +502,9 @@ fn help_flag_subcommand() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -540,6 +564,9 @@ fn help_flag_subsubcommand() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -656,6 +683,9 @@ fn help_with_global_option() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down Expand Up @@ -752,6 +782,9 @@ fn test_with_no_pager() {
Path to the cache directory [env: UV_CACHE_DIR=]
--config-file <CONFIG_FILE>
The path to a `uv.toml` file to use for configuration [env: UV_CONFIG_FILE=]
--no-config
Avoid discovering configuration files (`pyproject.toml`, `uv.toml`) in the current
directory, parent directories, or user configuration directories [env: UV_NO_CONFIG=]
-h, --help
Print help
-V, --version
Expand Down

0 comments on commit d51b429

Please sign in to comment.