Add NO_BUILD and NO_BUILD_PACKAGE environment variables (#11968)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
Similar to https://github.com/astral-sh/uv/pull/11399

This adds `UV_NO_BUILD` and `UV_NO_BUILD_PACKAGE` environment variables
for non-pip commands.

## Test Plan

<!-- How was it tested? -->
Tested manually and with snapshot tests.


Fixes #11963

Signed-off-by: Alex Lowe <alex@lowe.dev>
This commit is contained in:
Alex Lowe 2025-03-04 23:58:19 -05:00 committed by GitHub
parent 0f5b106dae
commit 7340ff72da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 102 additions and 2 deletions

View file

@ -4818,7 +4818,13 @@ pub struct BuildOptionsArgs {
/// When enabled, resolving will not run arbitrary Python code. The cached wheels of
/// already-built source distributions will be reused, but operations that require building
/// distributions will exit with an error.
#[arg(long, overrides_with("build"), help_heading = "Build options")]
#[arg(
long,
env = EnvVars::UV_NO_BUILD,
overrides_with("build"),
value_parser = clap::builder::BoolishValueParser::new(),
help_heading = "Build options",
)]
pub no_build: bool,
#[arg(
@ -4830,7 +4836,7 @@ pub struct BuildOptionsArgs {
pub build: bool,
/// Don't build source distributions for a specific package.
#[arg(long, help_heading = "Build options")]
#[arg(long, help_heading = "Build options", env = EnvVars::UV_NO_BUILD_PACKAGE, value_delimiter = ' ')]
pub no_build_package: Vec<PackageName>,
/// Don't install pre-built wheels.