Add --package support to uv build (#6990)

## Summary

This PR adds `--package` support to `uv build`, such that you can use
`--package` from anywhere in a workspace to build any member.

If a source directory is provided, we use that as the workspace root.

If a file is provided, we error.

For now, `uv build` only builds the current package, making it
semantically identical to `uv sync`.
This commit is contained in:
Charlie Marsh
2024-09-04 11:52:21 -04:00
committed by GitHub
parent 05ed4bc11d
commit 7aed94bed2
6 changed files with 321 additions and 21 deletions
+9
View File
@@ -1955,6 +1955,15 @@ pub struct BuildArgs {
#[arg(value_parser = parse_file_path)]
pub src: Option<PathBuf>,
/// Build a specific package in the workspace.
///
/// The workspace will be discovered from the provided source directory, or the current
/// directory if no source directory is provided.
///
/// If the workspace member does not exist, uv will exit with an error.
#[arg(long)]
pub package: Option<PackageName>,
/// The output directory to which distributions should be written.
///
/// Defaults to the `dist` subdirectory within the source directory, or the