Add --clear to uv build to remove old build artifacts (#16371)

Add `uv build --clear` that behaves like `rm -r ./dist && uv build` to
clear artifacts from previous builds. This avoids accidentally
publishing the wrong artifacts and removes accumulated old builds.

See https://github.com/astral-sh/uv/issues/10293#issuecomment-3405904013
Fixes #10293
This commit is contained in:
konsti
2025-10-27 19:15:17 +01:00
committed by GitHub
parent fe5d944afa
commit 804f1ff808
6 changed files with 88 additions and 2 deletions
+4
View File
@@ -2635,6 +2635,10 @@ pub struct BuildArgs {
#[arg(long, conflicts_with = "list")]
pub force_pep517: bool,
/// Clear the output directory before the build, removing stale artifacts.
#[arg(long)]
pub clear: bool,
/// Constrain build dependencies using the given requirements files when building distributions.
///
/// Constraints files are `requirements.txt`-like files that only control the _version_ of a