diff --git a/crates/uv-static/src/env_vars.rs b/crates/uv-static/src/env_vars.rs index 0c12fbd93..7d54ba266 100644 --- a/crates/uv-static/src/env_vars.rs +++ b/crates/uv-static/src/env_vars.rs @@ -644,4 +644,9 @@ impl EnvVars { /// error. #[attr_hidden] pub const UV_RUN_MAX_RECURSION_DEPTH: &'static str = "UV_RUN_MAX_RECURSION_DEPTH"; + + /// Overrides terminal width used for wrapping. This variable is not read by uv directly. + /// + /// This is a quasi-standard variable, described e.g. in `ncurses(3x)`. + pub const COLUMNS: &'static str = "COLUMNS"; } diff --git a/crates/uv/tests/it/common/mod.rs b/crates/uv/tests/it/common/mod.rs index f34e7ca59..f55a6e963 100644 --- a/crates/uv/tests/it/common/mod.rs +++ b/crates/uv/tests/it/common/mod.rs @@ -562,7 +562,11 @@ impl TestContext { command // When running the tests in a venv, ignore that venv, otherwise we'll capture warnings. .env_remove(EnvVars::VIRTUAL_ENV) + // Disable wrapping of uv output for readability / determinism in snapshots. .env(EnvVars::UV_NO_WRAP, "1") + // While we disable wrapping in uv above, invoked tools may still wrap their output so + // we set a fixed `COLUMNS` value for isolation from terminal width. + .env(EnvVars::COLUMNS, "100") .env(EnvVars::PATH, path) .env(EnvVars::HOME, self.home_dir.as_os_str()) .env(EnvVars::UV_PYTHON_INSTALL_DIR, "") diff --git a/crates/uv/tests/it/tool_run.rs b/crates/uv/tests/it/tool_run.rs index ede1f1871..9ca9146e3 100644 --- a/crates/uv/tests/it/tool_run.rs +++ b/crates/uv/tests/it/tool_run.rs @@ -1824,13 +1824,12 @@ fn tool_run_verbatim_name() { .arg("change_wheel_version") .arg("--help") .env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str()) - .env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###" + .env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r" success: true exit_code: 0 ----- stdout ----- - usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] - [--version VERSION] [--delete-old-wheel] - [--allow-same-version] + usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] [--version VERSION] + [--delete-old-wheel] [--allow-same-version] wheel positional arguments: @@ -1851,7 +1850,7 @@ fn tool_run_verbatim_name() { + installer==0.7.0 + packaging==24.0 + wheel==0.43.0 - "###); + "); uv_snapshot!(context.filters(), context.tool_run() .arg("change-wheel-version") @@ -1877,13 +1876,12 @@ fn tool_run_verbatim_name() { .arg("change_wheel_version") .arg("--help") .env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str()) - .env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###" + .env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r" success: true exit_code: 0 ----- stdout ----- - usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] - [--version VERSION] [--delete-old-wheel] - [--allow-same-version] + usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] [--version VERSION] + [--delete-old-wheel] [--allow-same-version] wheel positional arguments: @@ -1898,5 +1896,5 @@ fn tool_run_verbatim_name() { ----- stderr ----- Resolved [N] packages in [TIME] - "###); + "); } diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md index 432acb18f..99a5a375a 100644 --- a/docs/configuration/environment.md +++ b/docs/configuration/environment.md @@ -399,6 +399,12 @@ Used to detect Bash shell usage. Use to control color via `anstyle`. +### `COLUMNS` + +Overrides terminal width used for wrapping. This variable is not read by uv directly. + +This is a quasi-standard variable, described e.g. in `ncurses(3x)`. + ### `CONDA_DEFAULT_ENV` Used to determine if an active Conda environment is the base environment or not.