poetry: poetry install --extras doesn't work
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: macOS 10.14.6
- Poetry version: 1.0.3
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/anentropic/661458664b20923cf07f7e377972870b
Issue
The docs show a pyproject.toml:
[tool.poetry]
name = "awesome"
[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"
# A list of all of the optional dependencies, some of which are included in the
# below `extras`. They can be opted into by apps.
psycopg2 = { version = "^2.7", optional = true }
mysqlclient = { version = "^1.3", optional = true }
[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]
And then an example of installing the “extras”:
poetry install --extras "mysql pgsql"
But pasting the relevant part of this example into my own pyproject.toml (see gist) it doesn’t work:
$ poetry install --extras "mysql pgsql"
Installing dependencies from lock file
[ValueError]
Extra [mysql] is not specified.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 26
- Comments: 19 (10 by maintainers)
Commits related to this issue
- Convert poetry extras into regular dev deps Poetries extras seem to be broken https://github.com/python-poetry/poetry/issues/2073 — committed to Eisbrenner/windeval by Eisbrenner 4 years ago
- Update function signatures and add minimal app (#2) + Implement dict based func-signature in `io.products` * Implement new dictionary based function signature in windeval.io.products which contai... — committed to Eisbrenner/windeval by Eisbrenner 4 years ago
- Create release script Also remove the extras from pyproject.toml as those seem buggy: https://github.com/python-poetry/poetry/issues/2073 https://github.com/python-poetry/poetry/issues/1145 — committed to sprt/skippex by sprt 3 years ago
Looks like you can install multiple dependencies in a single set using the following approach:
resulting in the following changes to the pyproject.toml file:
But running
poetry update; poetry install -E API
doesn’t work yet.You need to add the following entry to the pyproject.toml file (NOTE you have to add the requirements specifier otherwise what gets passed to pip install complains and errors out):
and then
poetry update; poetry install -E API
works fine.My django-getpaid project has a
test
extra dependency group declared among others.poetry install
does not install pytestpoetry install -E test
does not install pytest either.I highly recommend writing extras syntax like this:
Any progress on this bug? It’s a blocker.