Poetry: `poetry add --extras security requests` fails with `ValueError`

Created on 8 Oct 2019  Â·  4Comments  Â·  Source: python-poetry/poetry

  • [ ] ~I am on the latest Poetry version.~
  • [x] I am on the master branch of Poetry.
  • [x] It can be reproduced on the latest beta version of Poetry.
  • [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).

  • OS version and name: any

  • Poetry version: 1.0.0a0 — 1.0.0b1
  • ~Link of a Gist with the contents of your~ pyproject.toml file: this bug could be reproduced with any pyproject.toml, so you can just generate a new one using poetry init.

Issue

Using poetry from master/develop branches or any recent alpha/beta release, it's not possible to add the requests package with the security extra.

$ poetry -V
Poetry version 1.0.0b1
$ poetry add --extras security requests -v
Using virtualenv: /home/mim/.cache/pypoetry/virtualenvs/test-poetry-requests-security-XPJu19SV-py3.7
Using version ^2.22.0 for requests

Updating dependencies
Resolving dependencies... (0.1s)

[ValueError]
Array has mixed types elements

Traceback (most recent call last):
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 132, in run
    status_code = command.handle(parsed_args, io)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 119, in handle
    status_code = self._do_handle(args, io)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 167, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/mim/.poetry/lib/poetry/console/commands/add.py", line 149, in handle
    status = installer.run()
  File "/home/mim/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/home/mim/.poetry/lib/poetry/installation/installer.py", line 189, in _do_install
    self._write_lock_file(local_repo)
  File "/home/mim/.poetry/lib/poetry/installation/installer.py", line 290, in _write_lock_file
    updated_lock = self._locker.set_lock_data(self._package, repo.packages)
  File "/home/mim/.poetry/lib/poetry/packages/locker.py", line 149, in set_lock_data
    lock['package'] = packages
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/container.py", line 551, in __setitem__
    self.append(key, value)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/container.py", line 91, in append
    item = _item(item)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/items.py", line 62, in item
    i = item(_v)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/items.py", line 46, in item
    val[k] = item(v, _parent=val)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/items.py", line 70, in item
    a.append(v)
  File "/home/mim/.poetry/lib/poetry/_vendor/py3.7/tomlkit/items.py", line 778, in append
    raise ValueError('Array has mixed types elements')
Bug

Most helpful comment

@Jamim Sorry for the confusion but while I saw the issue I did not see your related PR and I made the commit just before your comment mentionin your PR. I just commented and requested changes on your PR.

All 4 comments

Hi @sdispater,
I've already submitted a PR with a fix and an explanation of this bug.
It is #1439. Did you see it?

I see you recently commited af71f6c0e585ac20a029e1eccb6501898adb6395, so I'm quite confused now :confused:
Why did you completely ignore the proposed fix?

@sdispater
Even worse, af71f6c0e585ac20a029e1eccb6501898adb6395 doesn't cover all the cases due the code causing this issue is still there.
I've updated #1439, so could you please take a look?
Thanks!

@Jamim Sorry for the confusion but while I saw the issue I did not see your related PR and I made the commit just before your comment mentionin your PR. I just commented and requested changes on your PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdgyEdgemond picture EdgyEdgemond  Â·  3Comments

mozartilize picture mozartilize  Â·  3Comments

probablykasper picture probablykasper  Â·  3Comments

nikaro picture nikaro  Â·  3Comments

ambv picture ambv  Â·  3Comments