All contributions

astral-sh/uv

uv

An extremely fast Python package and project manager written in Rust. It creates projects, installs dependencies and manages virtual environments.

Language
Rust
GitHub stars
92,647
Merged changes
1
Project site
docs.astral.sh

What we changed

The UV_INIT_BUILD_BACKEND variable now acts as a default, so uv init --no-package and uv init --script no longer fail with a conflict against a --build-backend nobody passed.

What this work shows

  • CLI argument parsing with clap
  • Precedence of flags and environment variables
  • CLI snapshot tests in Rust
  • Python packaging and build backends
What was broken

An env var blocked uv init --no-package

With UV_INIT_BUILD_BACKEND set, uv init --app --no-package and uv init --script failed with an error that --no-package cannot be used with --build-backend, although nobody passed that flag. The clap library applies conflicts_with to values from environment variables too.

How we fixed it

The variable as a default

EnvironmentOptions reads UV_INIT_BUILD_BACKEND alongside the other environment settings, and uv init uses it only when it needs a backend. An explicit --build-backend wins, --script, --no-package and --virtual skip the variable, and an invalid value stops any command that loads these settings, uv sync included.

#22907

Merged change 1

  1. #22907 Let `--no-package` and `--script` take precedence over `UV_INIT_BUILD_BACKEND` Merged 26 October 2026

What it taught us

An environment variable should set a default, not pose as an argument typed on the command line. Keeping those two config sources apart in a CLI removes false conflicts and keeps the error where the user really passed clashing options.

More about this technology: Rust

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.