Skip to content

Commit

Permalink
docs: update docs about PEP 735
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer committed Feb 9, 2025
1 parent f0e0662 commit e522f40
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions docs/managing-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,30 @@ are part of an implicit `main` group. Those dependencies are required by your pr
Beside the `main` dependencies, you might have dependencies that are only needed to test your project
or to build the documentation.

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

{{< tabs tabTotal="2" tabID1="group-pep735" tabID2="group-poetry" tabName1="[dependency-groups]" tabName2="[tool.poetry]">}}

{{< tab tabID="group-pep735" >}}
```toml
[dependency-groups]
test = [
"pytest (>=6.0.0,<7.0.0)",
"pytest-mock",
]
```
{{< /tab >}}

{{< tab tabID="group-poetry" >}}
```toml
[tool.poetry.group.test.dependencies]
pytest = "^6.0.0"
pytest-mock = "*"
```
{{< /tab >}}
{{< /tabs >}}


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

{{< tabs tabTotal="2" tabID1="group-optional-pep735" tabID2="group-optional-poetry" tabName1="[dependency-groups]" tabName2="[tool.poetry]">}}

{{< tab tabID="group-optional-pep735" >}}
```toml
[dependency-groups]
docs = [
"mkdocs",
]

[tool.poetry.group.docs]
optional = true
```
{{< /tab >}}

{{< tab tabID="group-optional-poetry" >}}
```toml
[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
mkdocs = "*"
```
{{< /tab >}}
{{< /tabs >}}



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

0 comments on commit e522f40

Please sign in to comment.