Skip to content

Commit

Permalink
cleanup some dependency-group docs (#11284)
Browse files Browse the repository at this point in the history
Some additional details, more mentioning of related flags, and some
minor rewordings to avoid misconceptions I had from the current docs.

Closes #11205
  • Loading branch information
Gankra authored Feb 7, 2025
1 parent 092e78d commit 5c4b6d4
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 76 deletions.
90 changes: 55 additions & 35 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2697,9 +2697,10 @@ pub struct RunArgs {
#[arg(long, overrides_with("no_dev"), hide = true)]
pub dev: bool,

/// Omit the development dependency group.
/// Disable the development dependency group.
///
/// This option is an alias of `--no-group dev`.
/// See `--no-default-groups` to disable all default groups instead.
///
/// This option is only available when running in a project.
#[arg(long, overrides_with("dev"))]
Expand All @@ -2711,23 +2712,27 @@ pub struct RunArgs {
#[arg(long, conflicts_with_all = ["only_group", "only_dev"])]
pub group: Vec<GroupName>,

/// Exclude dependencies from the specified dependency group.
/// Disable the specified dependency group.
///
/// This options always takes precedence over default groups,
/// `--all-groups`, and `--group`.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,

/// Exclude dependencies from default groups.
/// Ignore the the default dependency groups.
///
/// `--group` can be used to include specific groups.
/// uv includes the groups defined in `tool.uv.default-groups` by default.
/// This disables that option, however, specific groups can still be included with `--group`.
#[arg(long)]
pub no_default_groups: bool,

/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// May be provided multiple times.
/// May be provided multiple times. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])]
pub only_group: Vec<GroupName>,

Expand All @@ -2745,9 +2750,9 @@ pub struct RunArgs {

/// Only include the development dependency group.
///
/// Omit other dependencies. The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// This option is an alias for `--only-group dev`.
/// This option is an alias for `--only-group dev`. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "all_groups", "no_dev"])]
pub only_dev: bool,

Expand Down Expand Up @@ -2969,17 +2974,18 @@ pub struct SyncArgs {
#[arg(long, overrides_with("no_dev"), hide = true)]
pub dev: bool,

/// Omit the development dependency group.
/// Disable the development dependency group.
///
/// This option is an alias for `--no-group dev`.
/// This option is an alias of `--no-group dev`.
/// See `--no-default-groups` to disable all default groups instead.
#[arg(long, overrides_with("dev"))]
pub no_dev: bool,

/// Only include the development dependency group.
///
/// Omit other dependencies. The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// This option is an alias for `--only-group dev`.
/// This option is an alias for `--only-group dev`. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "all_groups", "no_dev"])]
pub only_dev: bool,

Expand All @@ -2992,23 +2998,27 @@ pub struct SyncArgs {
#[arg(long, conflicts_with_all = ["only_group", "only_dev"])]
pub group: Vec<GroupName>,

/// Exclude dependencies from the specified dependency group.
/// Disable the specified dependency group.
///
/// This options always takes precedence over default groups,
/// `--all-groups`, and `--group`.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,

/// Exclude dependencies from default groups.
/// Ignore the the default dependency groups.
///
/// `--group` can be used to include specific groups.
/// uv includes the groups defined in `tool.uv.default-groups` by default.
/// This disables that option, however, specific groups can still be included with `--group`.
#[arg(long)]
pub no_default_groups: bool,

/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// May be provided multiple times.
/// May be provided multiple times. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])]
pub only_group: Vec<GroupName>,

Expand Down Expand Up @@ -3462,15 +3472,16 @@ pub struct TreeArgs {

/// Only include the development dependency group.
///
/// Omit other dependencies. The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// This option is an alias for `--only-group dev`.
/// This option is an alias for `--only-group dev`. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "all_groups", "no_dev"])]
pub only_dev: bool,

/// Omit the development dependency group.
/// Disable the development dependency group.
///
/// This option is an alias for `--no-group dev`.
/// This option is an alias of `--no-group dev`.
/// See `--no-default-groups` to disable all default groups instead.
#[arg(long, overrides_with("dev"))]
pub no_dev: bool,

Expand All @@ -3480,23 +3491,27 @@ pub struct TreeArgs {
#[arg(long, conflicts_with_all = ["only_group", "only_dev"])]
pub group: Vec<GroupName>,

/// Exclude dependencies from the specified dependency group.
/// Disable the specified dependency group.
///
/// This options always takes precedence over default groups,
/// `--all-groups`, and `--group`.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,

/// Exclude dependencies from default groups.
/// Ignore the the default dependency groups.
///
/// `--group` can be used to include specific groups.
/// uv includes the groups defined in `tool.uv.default-groups` by default.
/// This disables that option, however, specific groups can still be included with `--group`.
#[arg(long)]
pub no_default_groups: bool,

/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// May be provided multiple times.
/// May be provided multiple times. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])]
pub only_group: Vec<GroupName>,

Expand Down Expand Up @@ -3628,17 +3643,18 @@ pub struct ExportArgs {
#[arg(long, overrides_with("no_dev"), hide = true)]
pub dev: bool,

/// Omit the development dependency group.
/// Disable the development dependency group.
///
/// This option is an alias for `--no-group dev`.
/// This option is an alias of `--no-group dev`.
/// See `--no-default-groups` to disable all default groups instead.
#[arg(long, overrides_with("dev"))]
pub no_dev: bool,

/// Only include the development dependency group.
///
/// Omit other dependencies. The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// This option is an alias for `--only-group dev`.
/// This option is an alias for `--only-group dev`. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "all_groups", "no_dev"])]
pub only_dev: bool,

Expand All @@ -3648,23 +3664,27 @@ pub struct ExportArgs {
#[arg(long, conflicts_with_all = ["only_group", "only_dev"])]
pub group: Vec<GroupName>,

/// Exclude dependencies from the specified dependency group.
/// Disable the specified dependency group.
///
/// This options always takes precedence over default groups,
/// `--all-groups`, and `--group`.
///
/// May be provided multiple times.
#[arg(long)]
pub no_group: Vec<GroupName>,

/// Exclude dependencies from default groups.
/// Ignore the the default dependency groups.
///
/// `--group` can be used to include specific groups.
/// uv includes the groups defined in `tool.uv.default-groups` by default.
/// This disables that option, however, specific groups can still be included with `--group`.
#[arg(long)]
pub no_default_groups: bool,

/// Only include dependencies from the specified dependency group.
///
/// The project itself will also be omitted.
/// The project and its dependencies will be omitted.
///
/// May be provided multiple times.
/// May be provided multiple times. Implies `--no-default-groups`.
#[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])]
pub only_group: Vec<GroupName>,

Expand Down
11 changes: 6 additions & 5 deletions docs/concepts/projects/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ dev = [
```

The `dev` group is special-cased; there are `--dev`, `--only-dev`, and `--no-dev` flags to toggle
inclusion or exclusion of its dependencies. Additionally, the `dev` group is
[synced by default](#default-groups).
inclusion or exclusion of its dependencies. See `--no-default-groups` to disable all default groups
instead. Additionally, the `dev` group is [synced by default](#default-groups).

### Dependency groups

Expand All @@ -633,8 +633,8 @@ lint = [
]
```

Once groups are defined, the `--group`, `--only-group`, and `--no-group` options can be used to
include or exclude their dependencies.
Once groups are defined, the `--all-groups`, `--no-default-groups`, `--group`, `--only-group`, and
`--no-group` options can be used to include or exclude their dependencies.

!!! tip

Expand Down Expand Up @@ -664,7 +664,8 @@ default-groups = ["dev", "foo"]

!!! tip

To exclude a default group during `uv run` or `uv sync`, use `--no-group <name>`.
To disable this behaviour during `uv run` or `uv sync`, use `--no-default-groups`.
To exclude a specific default group, use `--no-group <name>`.

### Legacy `dev-dependencies`

Expand Down
Loading

0 comments on commit 5c4b6d4

Please sign in to comment.