@@ -613,20 +613,48 @@ instead. Additionally, the `dev` group is [synced by default](#default-groups).
613
613
614
614
### Dependency groups
615
615
616
+ uv supports
617
+ [ PyPA spec Dependency Groups] ( https://packaging.python.org/en/latest/specifications/dependency-groups/ ) :
618
+
619
+ ``` toml title="pyproject.toml"
620
+ [dependency-groups ]
621
+ dev = [
622
+ {include-group = " lint" },
623
+ " pytest" ,
624
+ ]
625
+ lint = [
626
+ " ruff"
627
+ ]
628
+ ```
629
+
630
+ uv requires that all dependency groups are compatible with each other and resolves all groups
631
+ together when creating the lockfile.
632
+
633
+ If dependencies declared in one group are not compatible with those in another group, uv will fail
634
+ to resolve the requirements of the project with an error unless you explicitly
635
+ [ declare them as conflicting] ( ./config.md#conflicting-dependencies ) .
636
+
637
+ #### CLI Options
638
+
616
639
Development dependencies can be divided into multiple groups, using the ` --group ` flag.
617
640
618
- For example, to add a development dependency in the ` lint ` group:
641
+ For example, to add a dependency in the ` ci ` group:
619
642
620
643
``` console
621
- $ uv add --group lint ruff
644
+ $ uv add --group ci tox pip-audit
622
645
```
623
646
624
- Which results in the following ` [dependency-groups] ` definition:
647
+ Which results in the updated definition:
625
648
626
649
``` toml title="pyproject.toml"
627
650
[dependency-groups ]
651
+ ci = [
652
+ " pip-audit" ,
653
+ " tox" ,
654
+ ]
628
655
dev = [
629
- " pytest"
656
+ {include-group = " lint" },
657
+ " pytest" ,
630
658
]
631
659
lint = [
632
660
" ruff"
@@ -636,21 +664,13 @@ lint = [
636
664
Once groups are defined, the ` --all-groups ` , ` --no-default-groups ` , ` --group ` , ` --only-group ` , and
637
665
` --no-group ` options can be used to include or exclude their dependencies.
638
666
639
- !!! tip
640
-
641
- The `--dev`, `--only-dev`, and `--no-dev` flags are equivalent to `--group dev`,
642
- `--only-group dev`, and `--no-group dev` respectively.
643
-
644
- uv requires that all dependency groups are compatible with each other and resolves all groups
645
- together when creating the lockfile.
646
-
647
- If dependencies declared in one group are not compatible with those in another group, uv will fail
648
- to resolve the requirements of the project with an error.
667
+ The ` --dev ` , ` --only-dev ` , and ` --no-dev ` flags are equivalent to ` --group dev ` , ` --only-group dev ` ,
668
+ and ` --no-group dev ` respectively.
649
669
650
670
!!! note
651
671
652
- If you have dependency groups that conflict with one another, resolution will fail
653
- unless you explicitly [declare them as conflicting](./config.md#conflicting-dependencies) .
672
+ `include-group` is not supported from the CLI ([#9054](https://github.com/astral-sh/uv/issues/9054)).
673
+ Those edits must be made manually .
654
674
655
675
### Default groups
656
676
0 commit comments