Given the following pyproject.toml
file, how do I install the optional package ipdb
?
[tool.poetry]
name = "yolo"
version = "1.0.0"
description = ""
authors = []
[tool.poetry.dependencies]
python = "^3.8"
Django = "^4.0.4"
ipdb = {version = "^0.13.6", optional = true}
[tool.poetry.dev-dependencies]
pytest = "^5.4.1"
The Poetry Documentation shows how to add an optional package to the pyproject.toml
file, but not how to actually install it if I am given the file and have a blank environment.
Optional dependencies must be clusters within an extra
to be installable: https://python-poetry.org/docs/pyproject/#extras
So, your pyproject.toml
could look like this:
[tool.poetry]
name = "yolo"
version = "1.0.0"
description = ""
authors = []
[tool.poetry.dependencies]
python = "^3.8"
Django = "^4.0.4"
ipdb = {version = "^0.13.6", optional = true}
[tool.poetry.dev-dependencies]
pytest = "^5.4.1"
[tool.poetry.extras]
debug = ["ipdb"]
Than use poetry install -E debug
to install this extra.
At the moment the CLI is missing an option to add an optional dependencies to an extra
group.
Side note: extras
are meant for additional functions of your package during runtime. If you only need ipdb
during development, I would suggest to add it a as dev-dependencies
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With