Skip to content

Commit

Permalink
Add example for dependency with multiple extras (python-poetry#9138)
Browse files Browse the repository at this point in the history
The currently existing example on how to install dependency extras only shows a single dependency:
`fastapi = {version="^0.92.0", extras=["all"]}`

Since right before this example it is shown how to install multiple extras using the command line interface, this can be confusing and lead to hard to understand missing dependencies:
`poetry install --extras "mysql pgsql"`

Note that the CLI has quotes around both extras and no commas, while in pyproject.toml each extra *must* be quoted and comma-separated, which is currently not documented.
  • Loading branch information
JSchoeck authored Mar 16, 2024
1 parent 75453c2 commit 9cda043
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ poetry install --all-extras
{{% note %}}
Note that `install --extras` and the variations mentioned above (`--all-extras`, `--extras foo`, etc.) only work on dependencies defined in the current project. If you want to install extras defined by dependencies, you'll have to express that in the dependency itself:
```toml
[tool.poetry.dependencies]
pandas = {version="^2.2.1", extras=["computation", "performance"]}
```
```toml
[tool.poetry.group.dev.dependencies]
fastapi = {version="^0.92.0", extras=["all"]}
```
Expand Down

0 comments on commit 9cda043

Please sign in to comment.