diff --git a/.env b/.env index 39058d8d5..439560f09 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ PATH=$PWD/bin:$PATH -PUFFIN_TEST_PYTHON_PATH=$PWD/bin +UV_TEST_PYTHON_PATH=$PWD/bin diff --git a/crates/uv-cache/src/cli.rs b/crates/uv-cache/src/cli.rs index fb7df391c..e4293367e 100644 --- a/crates/uv-cache/src/cli.rs +++ b/crates/uv-cache/src/cli.rs @@ -15,7 +15,7 @@ pub struct CacheArgs { no_cache: bool, /// Path to the cache directory. - #[arg(global = true, long, env = "PUFFIN_CACHE_DIR")] + #[arg(global = true, long, env = "UV_CACHE_DIR")] cache_dir: Option, } @@ -24,7 +24,7 @@ impl TryFrom for Cache { /// Prefer, in order: /// 1. A temporary cache directory, if the user requested `--no-cache`. - /// 2. The specific cache directory specified by the user via `--cache-dir` or `PUFFIN_CACHE_DIR`. + /// 2. The specific cache directory specified by the user via `--cache-dir` or `UV_CACHE_DIR`. /// 3. The system-appropriate cache directory. /// 4. A `.uv_cache` directory in the current working directory. /// diff --git a/crates/uv-dev/src/resolve_cli.rs b/crates/uv-dev/src/resolve_cli.rs index 5c74c674a..89678f071 100644 --- a/crates/uv-dev/src/resolve_cli.rs +++ b/crates/uv-dev/src/resolve_cli.rs @@ -43,7 +43,7 @@ pub(crate) struct ResolveCliArgs { cache_args: CacheArgs, #[arg(long)] exclude_newer: Option>, - #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "PUFFIN_INDEX_URL")] + #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "UV_INDEX_URL")] index_url: IndexUrl, #[clap(long)] extra_index_url: Vec, diff --git a/crates/uv-interpreter/src/interpreter.rs b/crates/uv-interpreter/src/interpreter.rs index 8fd6d0e0c..74ca950f9 100644 --- a/crates/uv-interpreter/src/interpreter.rs +++ b/crates/uv-interpreter/src/interpreter.rs @@ -136,7 +136,7 @@ impl Interpreter { /// - If a python version is given: `pythonx.y` /// - `python3` (unix) or `python.exe` (windows) /// - /// If `PUFFIN_TEST_PYTHON_PATH` is set, we will not check for Python versions in the + /// If `UV_TEST_PYTHON_PATH` is set, we will not check for Python versions in the /// global PATH, instead we will search using the provided path. Virtual environments /// will still be respected. /// @@ -204,13 +204,13 @@ impl Interpreter { Ok(None) } - /// Find the Python interpreter in `PATH`, respecting `PUFFIN_PYTHON_PATH`. + /// Find the Python interpreter in `PATH`, respecting `UV_PYTHON_PATH`. /// /// Returns `Ok(None)` if not found. pub fn find_executable + Into + Copy>( requested: R, ) -> Result, Error> { - let result = if let Some(isolated) = std::env::var_os("PUFFIN_TEST_PYTHON_PATH") { + let result = if let Some(isolated) = std::env::var_os("UV_TEST_PYTHON_PATH") { which::which_in(requested, Some(isolated), std::env::current_dir()?) } else { which::which(requested) diff --git a/crates/uv-interpreter/src/python_query.rs b/crates/uv-interpreter/src/python_query.rs index 20a4ab30e..8a0176efc 100644 --- a/crates/uv-interpreter/src/python_query.rs +++ b/crates/uv-interpreter/src/python_query.rs @@ -68,7 +68,7 @@ pub fn find_requested_python( Interpreter::query(&executable, platform, cache)? } } else if cfg!(windows) { - if let Some(python_overwrite) = env::var_os("PUFFIN_TEST_PYTHON_PATH") { + if let Some(python_overwrite) = env::var_os("UV_TEST_PYTHON_PATH") { let executable_dir = env::split_paths(&python_overwrite).find(|path| { path.as_os_str() .to_str() @@ -140,25 +140,21 @@ pub fn find_requested_python( /// Pick a sensible default for the python a user wants when they didn't specify a version. /// -/// We prefer the test overwrite `PUFFIN_TEST_PYTHON_PATH` if it is set, otherwise `python3`/`python` or +/// We prefer the test overwrite `UV_TEST_PYTHON_PATH` if it is set, otherwise `python3`/`python` or /// `python.exe` respectively. #[instrument] pub fn find_default_python(platform: &Platform, cache: &Cache) -> Result { let current_dir = env::current_dir()?; let python = if cfg!(unix) { - which::which_in( - "python3", - env::var_os("PUFFIN_TEST_PYTHON_PATH"), - current_dir, - ) - .or_else(|_| which::which("python")) - .map_err(|_| Error::NoPythonInstalledUnix)? + which::which_in("python3", env::var_os("UV_TEST_PYTHON_PATH"), current_dir) + .or_else(|_| which::which("python")) + .map_err(|_| Error::NoPythonInstalledUnix)? } else if cfg!(windows) { // TODO(konstin): Is that the right order, or should we look for `py --list-paths` first? With the current way // it works even if the python launcher is not installed. if let Ok(python) = which::which_in( "python.exe", - env::var_os("PUFFIN_TEST_PYTHON_PATH"), + env::var_os("UV_TEST_PYTHON_PATH"), current_dir, ) { python @@ -182,7 +178,7 @@ pub fn find_default_python(platform: &Platform, cache: &Cache) -> Result to read python /// installations from the registry instead. fn installed_pythons_windows() -> Result, Error> { - // TODO(konstin): We're not checking PUFFIN_TEST_PYTHON_PATH here, no test currently depends on it. + // TODO(konstin): We're not checking UV_TEST_PYTHON_PATH here, no test currently depends on it. // TODO(konstin): Special case the not found error let output = info_span!("py_list_paths") @@ -223,7 +219,7 @@ fn installed_pythons_windows() -> Result, Error> { } pub(crate) fn find_python_windows(major: u8, minor: u8) -> Result, Error> { - if let Some(python_overwrite) = env::var_os("PUFFIN_TEST_PYTHON_PATH") { + if let Some(python_overwrite) = env::var_os("UV_TEST_PYTHON_PATH") { let executable_dir = env::split_paths(&python_overwrite).find(|path| { path.as_os_str() .to_str() diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index f0d91635d..48b6e2785 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -234,7 +234,7 @@ struct PipCompileArgs { refresh_package: Vec, /// The URL of the Python Package Index. - #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "PUFFIN_INDEX_URL")] + #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "UV_INDEX_URL")] index_url: IndexUrl, /// Extra URLs of package indexes to use, in addition to `--index-url`. @@ -358,7 +358,7 @@ struct PipSyncArgs { link_mode: install_wheel_rs::linker::LinkMode, /// The URL of the Python Package Index. - #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "PUFFIN_INDEX_URL")] + #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "UV_INDEX_URL")] index_url: IndexUrl, /// Extra URLs of package indexes to use, in addition to `--index-url`. @@ -515,7 +515,7 @@ struct PipInstallArgs { output_file: Option, /// The URL of the Python Package Index. - #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "PUFFIN_INDEX_URL")] + #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "UV_INDEX_URL")] index_url: IndexUrl, /// Extra URLs of package indexes to use, in addition to `--index-url`. @@ -644,7 +644,7 @@ struct VenvArgs { name: PathBuf, /// The URL of the Python Package Index. - #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "PUFFIN_INDEX_URL")] + #[clap(long, short, default_value = IndexUrl::Pypi.as_str(), env = "UV_INDEX_URL")] index_url: IndexUrl, /// Extra URLs of package indexes to use, in addition to `--index-url`. @@ -770,7 +770,7 @@ async fn run() -> Result { .break_words(false) .word_separator(textwrap::WordSeparator::AsciiSpace) .word_splitter(textwrap::WordSplitter::NoHyphenation) - .wrap_lines(env::var("PUFFIN_NO_WRAP").map(|_| false).unwrap_or(true)) + .wrap_lines(env::var("UV_NO_WRAP").map(|_| false).unwrap_or(true)) .build(), ) }))?; @@ -1022,7 +1022,7 @@ async fn run() -> Result { } fn main() -> ExitCode { - let result = if let Ok(stack_size) = env::var("PUFFIN_STACK_SIZE") { + let result = if let Ok(stack_size) = env::var("UV_STACK_SIZE") { // Artificially limit the stack size to test for stack overflows. Windows has a default stack size of 1MB, // which is lower than the linux and mac default. // https://learn.microsoft.com/en-us/cpp/build/reference/stack-stack-allocations?view=msvc-170 diff --git a/crates/uv/tests/pip_compile_scenarios.rs b/crates/uv/tests/pip_compile_scenarios.rs index 96bb81486..1d840e7f6 100644 --- a/crates/uv/tests/pip_compile_scenarios.rs +++ b/crates/uv/tests/pip_compile_scenarios.rs @@ -31,8 +31,8 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command { .arg("--cache-dir") .arg(context.cache_dir.path()) .env("VIRTUAL_ENV", context.venv.as_os_str()) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&context.temp_dir); command } diff --git a/crates/uv/tests/pip_install.rs b/crates/uv/tests/pip_install.rs index f210969b1..d9cabf262 100644 --- a/crates/uv/tests/pip_install.rs +++ b/crates/uv/tests/pip_install.rs @@ -673,7 +673,7 @@ fn reinstall_no_binary() { if cfg!(all(windows, debug_assertions)) { // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the // default windows stack of 1MB - command.env("PUFFIN_STACK_SIZE", (2 * 1024 * 1024).to_string()); + command.env("UV_STACK_SIZE", (2 * 1024 * 1024).to_string()); } uv_snapshot!(command, @r###" success: true @@ -703,7 +703,7 @@ fn reinstall_no_binary() { if cfg!(all(windows, debug_assertions)) { // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the // default windows stack of 1MB - command.env("PUFFIN_STACK_SIZE", (2 * 1024 * 1024).to_string()); + command.env("UV_STACK_SIZE", (2 * 1024 * 1024).to_string()); } uv_snapshot!(command, @r###" success: true @@ -739,7 +739,7 @@ fn reinstall_no_binary() { if cfg!(all(windows, debug_assertions)) { // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the // default windows stack of 1MB - command.env("PUFFIN_STACK_SIZE", (2 * 1024 * 1024).to_string()); + command.env("UV_STACK_SIZE", (2 * 1024 * 1024).to_string()); } uv_snapshot!(filters, command, @r###" success: true diff --git a/crates/uv/tests/pip_install_scenarios.rs b/crates/uv/tests/pip_install_scenarios.rs index 5b65aaba6..7fceab261 100644 --- a/crates/uv/tests/pip_install_scenarios.rs +++ b/crates/uv/tests/pip_install_scenarios.rs @@ -50,7 +50,7 @@ fn command(context: &TestContext) -> Command { .arg("--cache-dir") .arg(context.cache_dir.path()) .env("VIRTUAL_ENV", context.venv.as_os_str()) - .env("PUFFIN_NO_WRAP", "1") + .env("UV_NO_WRAP", "1") .current_dir(&context.temp_dir); command } diff --git a/crates/uv/tests/pip_sync.rs b/crates/uv/tests/pip_sync.rs index e6d6f2106..9eda54d5a 100644 --- a/crates/uv/tests/pip_sync.rs +++ b/crates/uv/tests/pip_sync.rs @@ -329,7 +329,7 @@ fn link() -> Result<()> { .arg(context.cache_dir.path()) .arg("--python") .arg("3.12") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&context.temp_dir) .assert() .success(); diff --git a/crates/uv/tests/venv.rs b/crates/uv/tests/venv.rs index 79ea1c3f9..5b4030149 100644 --- a/crates/uv/tests/venv.rs +++ b/crates/uv/tests/venv.rs @@ -36,7 +36,7 @@ fn create_venv() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_TEST_PYTHON_PATH", bin.clone()) + .env("UV_TEST_PYTHON_PATH", bin.clone()) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -68,8 +68,8 @@ fn create_venv() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -109,8 +109,8 @@ fn create_venv_defaults_to_cwd() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -152,8 +152,8 @@ fn seed() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -190,8 +190,8 @@ fn create_venv_unknown_python_minor() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir); if cfg!(windows) { uv_snapshot!(&mut command, @r###" @@ -245,8 +245,8 @@ fn create_venv_unknown_python_patch() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: false exit_code: 1 @@ -286,8 +286,8 @@ fn create_venv_python_patch() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -331,8 +331,8 @@ fn file_exists() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: false exit_code: 1 @@ -378,8 +378,8 @@ fn empty_dir_exists() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: true exit_code: 0 @@ -424,8 +424,8 @@ fn non_empty_dir_exists() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&temp_dir), @r###" success: false exit_code: 1 @@ -470,7 +470,7 @@ fn virtualenv_compatibility() -> Result<()> { .arg(cache_dir.path()) .arg("--exclude-newer") .arg(EXCLUDE_NEWER) - .env("PUFFIN_TEST_PYTHON_PATH", bin.clone()) + .env("UV_TEST_PYTHON_PATH", bin.clone()) .current_dir(&temp_dir), @r###" success: true exit_code: 0 diff --git a/scripts/scenarios/templates/compile.mustache b/scripts/scenarios/templates/compile.mustache index 0f4750f61..7244754f7 100644 --- a/scripts/scenarios/templates/compile.mustache +++ b/scripts/scenarios/templates/compile.mustache @@ -31,8 +31,8 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command { .arg("--cache-dir") .arg(context.cache_dir.path()) .env("VIRTUAL_ENV", context.venv.as_os_str()) - .env("PUFFIN_NO_WRAP", "1") - .env("PUFFIN_TEST_PYTHON_PATH", bin) + .env("UV_NO_WRAP", "1") + .env("UV_TEST_PYTHON_PATH", bin) .current_dir(&context.temp_dir); command } diff --git a/scripts/scenarios/templates/install.mustache b/scripts/scenarios/templates/install.mustache index cbcae68f4..3a1bcbd13 100644 --- a/scripts/scenarios/templates/install.mustache +++ b/scripts/scenarios/templates/install.mustache @@ -51,7 +51,7 @@ fn command(context: &TestContext) -> Command { .arg("--cache-dir") .arg(context.cache_dir.path()) .env("VIRTUAL_ENV", context.venv.as_os_str()) - .env("PUFFIN_NO_WRAP", "1") + .env("UV_NO_WRAP", "1") .current_dir(&context.temp_dir); command } diff --git a/scripts/scenarios/update.py b/scripts/scenarios/update.py index ef788c978..334a76d03 100755 --- a/scripts/scenarios/update.py +++ b/scripts/scenarios/update.py @@ -24,7 +24,7 @@ Usage: Override the default PyPI index for uv and update the scenarios - $ PUFFIN_INDEX_URL="http://localhost:3141/packages/all/+simple" ./scripts/scenarios/update.py + $ UV_INDEX_URL="http://localhost:3141/packages/all/+simple" ./scripts/scenarios/update.py Requirements: