Poetry: extras do not work

Created on 9 Jul 2018  路  4Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue


While the documentation says that poetry install -E booth should install tornado for the above gist, it just does not work at all, with no helpful output:

$ poetry install -E booth -vvv
Virtualenv swartz-py3.6 already exists.
Using virtualenv: /home/rsa/.cache/pypoetry/virtualenvs/swartz-py3.6
Installing dependencies from lock file

[ValueError]        
Extra [booth] is not specified.  

Exception trace:
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/command.py in run() at line 72
   return super(BaseCommand, self).run(i, o)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/install.py in handle() at line 50
   return installer.run()
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/poetry/installation/installer.py in run() at line 76
   self._do_install(local_repo)
 /home/rsa/.local/venvs/poetry/lib/python3.6/site-packages/poetry/installation/installer.py in _do_install() at line 176
   raise ValueError("Extra [{}] is not specified.".format(extra))

install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]

Most helpful comment

I can confirm that removing lockfile works. Here's all I've done:

  • added dependency with poetry add --optional tornado
  • manually added [tool.poetry.extras] block, as there seems to be no interface to do it with poetry
  • ran poetry install -E booth, even though tornado was already installed
  • poof

Should one want to reproduce.

All 4 comments

Random bystander, but I figured I'd try your pyproject.toml as I've had no problems with extras when I tried.

I tried with your pyproject.toml and it worked fine.

[david@darvid-pc tmp]$ poetry install -E booth
Creating virtualenv swartz-py3.6 in /home/david/Projects/tmp/.venv
Updating dependencies
Resolving dependencies... (2.3s)


Package operations: 16 installs, 0 updates, 0 removals

Writing lock file

  - Installing six (1.11.0)
  - Installing atomicwrites (1.1.5)
  - Installing attrs (18.1.0)
  - Installing mccabe (0.6.1)
  - Installing more-itertools (4.2.0)
  - Installing pluggy (0.6.0)
  - Installing py (1.5.4)
  - Installing pycodestyle (2.3.1)
  - Installing pyflakes (1.6.0)
  - Installing coverage (4.5.1)
  - Installing flake8 (3.5.0)
  - Installing pytest (3.6.3)
  - Installing dataclasses (0.6)
  - Installing pytest-cov (2.5.1)
  - Installing pytest-flake8 (1.0.1)
  - Installing tornado (5.0.2)
[david@darvid-pc tmp]$ cat pyproject.toml 
[tool.poetry]
name = "swartz"
version = "0.1.0"
description = ""
authors = ["Ranieri Althoff <[email protected]>"]

[tool.poetry.dependencies]
python = "*"
dataclasses = "^0.6.0"
tornado = {version = "^5.0", optional = true}

[tool.poetry.dev-dependencies]
pytest = "^3.5"
pytest-cov = "^2.5"
pytest-flake8 = "^1.0"

[tool.poetry.extras]
booth = ["tornado"]
[david@darvid-pc tmp]$ 

I wasn't able to reproduce it either. Could you remove the lock file and try again?

~/swartz $ curl -O "https://gist.githubusercontent.com/ranisalt/57a060be31711820ffbf7d48c577c087/raw/3f77586193d63a2f10bea4de288fc1009a9bb651/pyproject.toml"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   358  100   358    0     0    932      0 --:--:-- --:--:-- --:--:--   932
~/swartz $ poetry install -E booth
Creating virtualenv swartz-py3.6 in /home/cauebs/swartz/.venv
Updating dependencies
Resolving dependencies... (0.1s)


Package operations: 16 installs, 0 updates, 0 removals

Writing lock file

  - Installing six (1.11.0)
  - Installing atomicwrites (1.1.5)
  - Installing attrs (18.1.0)
  - Installing mccabe (0.6.1)
  - Installing more-itertools (4.2.0)
  - Installing pluggy (0.6.0)
  - Installing py (1.5.4)
  - Installing pycodestyle (2.3.1)
  - Installing pyflakes (1.6.0)
  - Installing coverage (4.5.1)
  - Installing flake8 (3.5.0)
  - Installing pytest (3.6.3)
  - Installing dataclasses (0.6)
  - Installing pytest-cov (2.5.1)
  - Installing pytest-flake8 (1.0.1)
  - Installing tornado (5.0.2)
~/swartz $ poetry --version
Poetry 0.11.2

I can confirm that removing lockfile works. Here's all I've done:

  • added dependency with poetry add --optional tornado
  • manually added [tool.poetry.extras] block, as there seems to be no interface to do it with poetry
  • ran poetry install -E booth, even though tornado was already installed
  • poof

Should one want to reproduce.

Yeah, this is the goal in #75. We need to detect changes in pyproject.toml and warn the user if the lockfile is outdated.

Was this page helpful?
0 / 5 - 0 ratings