Skip to content

Commit

Permalink
Automatically detect workspace packages in uv add
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 26, 2024
1 parent 1ee201d commit d54523f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/commands/project/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::settings::ResolverInstallerSettings;
#[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
pub(crate) async fn add(
requirements: Vec<RequirementsSource>,
workspace: bool,
dev: bool,
editable: Option<bool>,
raw: bool,
Expand Down Expand Up @@ -145,6 +144,7 @@ pub(crate) async fn add(
(pep508_rs::Requirement::from(req), None)
} else {
// Otherwise, try to construct the source.
let workspace = project.workspace().packages().contains_key(&req.name);
let result = Source::from_requirement(
req.source.clone(),
workspace,
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ async fn run() -> Result<ExitStatus> {

commands::add(
args.requirements,
args.workspace,
args.dev,
args.editable,
args.raw,
Expand Down
3 changes: 0 additions & 3 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ impl LockSettings {
pub(crate) struct AddSettings {
pub(crate) requirements: Vec<RequirementsSource>,
pub(crate) dev: bool,
pub(crate) workspace: bool,
pub(crate) editable: Option<bool>,
pub(crate) raw: bool,
pub(crate) rev: Option<String>,
Expand All @@ -450,7 +449,6 @@ impl AddSettings {
let AddArgs {
requirements,
dev,
workspace,
editable,
raw,
rev,
Expand All @@ -469,7 +467,6 @@ impl AddSettings {

Self {
requirements,
workspace,
dev,
editable,
raw,
Expand Down
6 changes: 1 addition & 5 deletions crates/uv/tests/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,7 @@ fn add_remove_workspace() -> Result<()> {

let child1 = context.temp_dir.join("child1");
let mut add_cmd = context.add(&["child2"]);
add_cmd
.arg("--preview")
.arg("--workspace")
.current_dir(&child1);
add_cmd.arg("--preview").current_dir(&child1);

uv_snapshot!(context.filters(), add_cmd, @r###"
success: true
Expand Down Expand Up @@ -919,7 +916,6 @@ fn add_workspace_editable() -> Result<()> {
let mut add_cmd = context.add(&["child2"]);
add_cmd
.arg("--editable")
.arg("--workspace")
.arg("--preview")
.current_dir(&child1);

Expand Down

0 comments on commit d54523f

Please sign in to comment.