Skip to content

Commit

Permalink
Set --dev to default for uv run and uv sync (#4118)
Browse files Browse the repository at this point in the history
## Summary

Closes #4117.
  • Loading branch information
charliermarsh authored Jun 7, 2024
1 parent dcf70a1 commit d3651c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 6 additions & 4 deletions crates/uv/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1691,10 +1691,11 @@ pub(crate) struct RunArgs {
pub(crate) no_all_extras: bool,

/// Include development dependencies.
#[arg(long, overrides_with("no_dev"))]
#[arg(long, overrides_with("no_dev"), hide = true)]
pub(crate) dev: bool,

#[arg(long, conflicts_with("offline"), overrides_with("dev"), hide = true)]
/// Omit development dependencies.
#[arg(long, overrides_with("dev"))]
pub(crate) no_dev: bool,

/// The command to run.
Expand Down Expand Up @@ -1779,10 +1780,11 @@ pub(crate) struct SyncArgs {
pub(crate) no_all_extras: bool,

/// Include development dependencies.
#[arg(long, overrides_with("no_dev"))]
#[arg(long, overrides_with("no_dev"), hide = true)]
pub(crate) dev: bool,

#[arg(long, conflicts_with("offline"), overrides_with("dev"), hide = true)]
/// Omit development dependencies.
#[arg(long, overrides_with("dev"))]
pub(crate) no_dev: bool,

/// Refresh all cached data.
Expand Down
5 changes: 2 additions & 3 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl RunSettings {
flag(all_extras, no_all_extras).unwrap_or_default(),
extra.unwrap_or_default(),
),
dev: flag(dev, no_dev).unwrap_or(false),
dev: flag(dev, no_dev).unwrap_or(true),
target,
args,
with,
Expand Down Expand Up @@ -278,7 +278,7 @@ impl SyncSettings {
flag(all_extras, no_all_extras).unwrap_or_default(),
extra.unwrap_or_default(),
),
dev: flag(dev, no_dev).unwrap_or(false),
dev: flag(dev, no_dev).unwrap_or(true),
python,
}
}
Expand Down Expand Up @@ -445,7 +445,6 @@ impl PipCompileSettings {
PipOptions {
python,
system: flag(system, no_system),

index_url: index_args.index_url.and_then(Maybe::into_option),
extra_index_url: index_args.extra_index_url.map(|extra_index_urls| {
extra_index_urls
Expand Down
6 changes: 3 additions & 3 deletions crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ fn lock_dev() -> Result<()> {
});

// Install from the lockfile, excluding development dependencies.
uv_snapshot!(context.filters(), context.sync(), @r###"
uv_snapshot!(context.filters(), context.sync().arg("--no-dev"), @r###"
success: true
exit_code: 0
----- stdout -----
Expand All @@ -1904,8 +1904,8 @@ fn lock_dev() -> Result<()> {
+ project==0.1.0 (from file://[TEMP_DIR]/)
"###);

// Install from the lockfile, including development dependencies.
uv_snapshot!(context.filters(), context.sync().arg("--dev"), @r###"
// Install from the lockfile, including development dependencies (the default).
uv_snapshot!(context.filters(), context.sync(), @r###"
success: true
exit_code: 0
----- stdout -----
Expand Down

0 comments on commit d3651c1

Please sign in to comment.