Skip to content

Commit db3ee35

Browse files
committed
docs: update docs about PEP 735
1 parent 91aaea5 commit db3ee35

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

docs/managing-dependencies.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,30 @@ are part of an implicit `main` group. Those dependencies are required by your pr
2727
Beside the `main` dependencies, you might have dependencies that are only needed to test your project
2828
or to build the documentation.
2929

30-
To declare a new dependency group, use a `tool.poetry.group.<group>` section
31-
where `<group>` is the name of your dependency group (for instance, `test`):
30+
To declare a new dependency group, use a `dependency-groups` section according to PEP 735 or
31+
a `tool.poetry.group.<group>` section where `<group>` is the name of your dependency group (for instance, `test`):
3232

33+
{{< tabs tabTotal="2" tabID1="group-pep735" tabID2="group-poetry" tabName1="[dependency-groups]" tabName2="[tool.poetry]">}}
34+
35+
{{< tab tabID="group-pep735" >}}
36+
```toml
37+
[dependency-groups]
38+
test = [
39+
"pytest (>=6.0.0,<7.0.0)",
40+
"pytest-mock",
41+
]
42+
```
43+
{{< /tab >}}
44+
45+
{{< tab tabID="group-poetry" >}}
3346
```toml
3447
[tool.poetry.group.test.dependencies]
3548
pytest = "^6.0.0"
3649
pytest-mock = "*"
3750
```
51+
{{< /tab >}}
52+
{{< /tabs >}}
53+
3854

3955
{{% note %}}
4056
All dependencies **must be compatible with each other** across groups since they will
@@ -60,13 +76,32 @@ A dependency group can be declared as optional. This makes sense when you have
6076
a group of dependencies that are only required in a particular environment or for
6177
a specific purpose.
6278

79+
{{< tabs tabTotal="2" tabID1="group-optional-pep735" tabID2="group-optional-poetry" tabName1="[dependency-groups]" tabName2="[tool.poetry]">}}
80+
81+
{{< tab tabID="group-optional-pep735" >}}
82+
```toml
83+
[dependency-groups]
84+
docs = [
85+
"mkdocs",
86+
]
87+
88+
[tool.poetry.group.docs]
89+
optional = true
90+
```
91+
{{< /tab >}}
92+
93+
{{< tab tabID="group-optional-poetry" >}}
6394
```toml
6495
[tool.poetry.group.docs]
6596
optional = true
6697

6798
[tool.poetry.group.docs.dependencies]
6899
mkdocs = "*"
69100
```
101+
{{< /tab >}}
102+
{{< /tabs >}}
103+
104+
70105

71106
Optional groups can be installed in addition to the **default** dependencies by using the `--with`
72107
option of the [`install`]({{< relref "cli#install" >}}) command.

0 commit comments

Comments
 (0)