Poetry: Duplicate dependency export

Created on 3 Feb 2020  路  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).
  • OS version and name: elementary OS 5.0 Juno
  • Poetry version:1.0.3
  • Link of a Gist with the contents of your pyproject.toml file:

    pyproject.toml
[tool.poetry]
name = "tmpoetry"
version = "0.1.0"
description = "sdfg"
authors = ["Author <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
mypy = "^0.701"
pylint = "^2.3"

Issue

  • When a (sub)dependency has different requirements for different python versions, it appears twice in poetry.lock. In itself this is no problem, but poetry export generates duplicate entries.

  • In this use case, the command poetry add fails because said library has "conflifting" versions.
    (try poetry add astroid)

Bug

Most helpful comment

Poetry 1.0.5 fails to export its own dependencies because of this.

Reproduce:

$ git clone --branch 1.0.5 https://github.com/python-poetry/poetry
$ cd poetry
$ poetry export -f requirements.txt --without-hashes | grep idna
idna==2.8
idna==2.9

All 4 comments

Same issue here.

[tool.poetry]
name = "hello"
version = "2020.02.27"
description = "zzzz"
authors = ["aarrr <[email protected]>"]

[tool.poetry.dependencies]
python = "~2.7 || ~3.7"

pytest = "*"
firebase-admin = "*"

Anyone has a workaround for this?

I'm currently forced to manually specify the different versions in the pyproject.toml file.

@azdkj532 I have the same issue with pytest specifically, which results in dual zipp packages in the requirements file.

Currently my solution is adding this:

zipp = "^1"

poetry export output without the fix:

atomicwrites==1.3.0
attrs==19.3.0
colorama==0.4.3; sys_platform == "win32" and python_version != "3.4"
configparser==4.0.2; python_version < "3"
contextlib2==0.6.0.post1; python_version < "3.4"
funcsigs==1.0.2; python_version < "3.0"
importlib-metadata==1.6.0; python_version < "3.8"
more-itertools==5.0.0; python_version <= "2.7"
more-itertools==8.2.0; python_version > "2.7"
packaging==20.3
pathlib2==2.3.5; python_version < "3.6"
pluggy==0.13.1
py==1.8.1
pyparsing==2.4.6
pytest==4.6.9
scandir==1.10.0; python_version < "3.5"
six==1.14.0
wcwidth==0.1.9
zipp==1.2.0; python_version < "3.8"
zipp==3.1.0; python_version < "3.8"

poetry export output with the fix:

atomicwrites==1.3.0
attrs==19.3.0
colorama==0.4.3; sys_platform == "win32" and python_version != "3.4"
configparser==4.0.2; python_version < "3"
contextlib2==0.6.0.post1; python_version < "3.4"
funcsigs==1.0.2; python_version < "3.0"
importlib-metadata==1.6.0; python_version < "3.8"
more-itertools==5.0.0; python_version <= "2.7"
more-itertools==8.2.0; python_version > "2.7"
packaging==20.3
pathlib2==2.3.5; python_version < "3.6"
pluggy==0.13.1
py==1.8.1
pyparsing==2.4.6
pytest==4.6.9
scandir==1.10.0; python_version < "3.5"
six==1.14.0
wcwidth==0.1.9
zipp==1.2.0

Poetry 1.0.5 fails to export its own dependencies because of this.

Reproduce:

$ git clone --branch 1.0.5 https://github.com/python-poetry/poetry
$ cd poetry
$ poetry export -f requirements.txt --without-hashes | grep idna
idna==2.8
idna==2.9

It's not just poetry export - poetry show has the same problem.

Was this page helpful?
0 / 5 - 0 ratings