mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Automatically detect workspace packages in uv add
(#4557)
## Summary If the package _isn't_ marked as `workspace = true`, locking will fail given: ```rust let workspace_package_declared = // We require that when you use a package that's part of the workspace, ... !workspace.packages().contains_key(&requirement.name) // ... it must be declared as a workspace dependency (`workspace = true`), ... || matches!( source, Some(Source::Workspace { // By using toml, we technically support `workspace = false`. workspace: true, .. }) ) // ... except for recursive self-inclusion (extras that activate other extras), e.g. // `framework[machine_learning]` depends on `framework[cuda]`. || &requirement.name == project_name; if !workspace_package_declared { return Err(LoweringError::UndeclaredWorkspacePackage); } ``` Closes https://github.com/astral-sh/uv/issues/4552.
This commit is contained in:
parent
a328c7b995
commit
45c271d15d
6 changed files with 46 additions and 23 deletions
|
@ -1749,10 +1749,6 @@ pub struct AddArgs {
|
|||
#[arg(long)]
|
||||
pub dev: bool,
|
||||
|
||||
/// Add the requirements as workspace dependencies.
|
||||
#[arg(long)]
|
||||
pub workspace: bool,
|
||||
|
||||
/// Add the requirements as editables.
|
||||
#[arg(long, default_missing_value = "true", num_args(0..=1))]
|
||||
pub editable: Option<bool>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue