---
title: "uv: UV_INIT_BUILD_BACKEND precedence in a Rust CLI | VulCode"
description: "A fix to uv, the Python package manager written in Rust: UV_INIT_BUILD_BACKEND now yields to --no-package and --script instead of raising a clap conflict."
url: "https://vulcode.com/en/opensource/contributions/uv"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/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.

[See the repository](https://github.com/astral-sh/uv) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Rust
- **GitHub stars**: 92,647
- **Merged changes**: 1
- **Project site**: [docs.astral.sh](https://docs.astral.sh/uv)

## 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](https://github.com/astral-sh/uv/pull/22907)

## Merged change 1

- [#22907 Let `--no-package` and `--script` take precedence over `UV_INIT_BUILD_BACKEND` Merged 26 October 2026](https://github.com/astral-sh/uv/pull/22907)

## 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](https://vulcode.com/en/technologies/rust)

## Other projects we write code for

- [**Zed** Rust · 95,562 stars A fast code editor in Rust from the creators of Atom and Tree-sitter, with live multiplayer editing.](https://vulcode.com/en/opensource/contributions/zed)

- [**ripgrep** Rust · 70,186 stars A command line tool that recursively searches directories for a regex pattern while respecting your .gitignore. Written in Rust.](https://vulcode.com/en/opensource/contributions/ripgrep)

- [**Alacritty** Rust · 66,271 stars A cross-platform terminal emulator rendered with OpenGL, written in Rust and configured with a TOML file.](https://vulcode.com/en/opensource/contributions/alacritty)

- [**Gleam** Rust · 22,083 stars A friendly programming language for building type-safe, scalable systems. Its compiler is written in Rust.](https://vulcode.com/en/opensource/contributions/gleam)

- [**Sonic** Rust · 21,387 stars A lightweight full-text search backend in Rust, an alternative to Elasticsearch that runs in a few megabytes of RAM.](https://vulcode.com/en/opensource/contributions/sonic)

- [**Pagefind** Rust · 5,575 stars A Rust search engine for static sites that indexes the built site and only sends the needed parts of the index to the browser.](https://vulcode.com/en/opensource/contributions/pagefind)

## Describe your project.

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

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
