Skip to content

Poetry 1.1.2 uses an invalid format when exporting local file dependencies #3189

@akpircher

Description

@akpircher
  • 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).

Issue

While I see a bunch of new issues for export, I don't see anything specifically for this one, and want to make sure it doesn't get missed.

poetry export for poetry 1.1.2 uses an invalid/deprecated format for local file dependencies, however poetry 1.0.10 does not.
Specifically, it uses the package @ path/to/local/file.whl format, which does not work for pip 20.0.1 or later. Notably, the format did not cause an error when 19.2.3 was installed.

I noticed this bug after updating poetry from 1.0.10 to 1.1.2. Our build process builds a Docker image that pip installs the exported requirements file.

Steps to reproduce:

$ poetry new example
$ cd example/
$ mkdir third_party
$ pip3 wheel --no-deps -w third_party black
$ poetry add third_party/black-20.8b1-py3-none-any.whl
$ poetry export -o requirements.txt
$ poetry shell
$ python -m pip install -U pip==20.*  # for the purpose of the demo
$ pip3 install -r requirements.txt
ERROR: Invalid requirement: 'black @ third_party/black-20.8b1-py3-none-any.whl' (from line 4 of requirements.txt)
Hint: It looks like a path. File 'black @ third_party/black-20.8b1-py3-none-any.whl' does not exist.
Copy-paste-friendly version of steps (no $ or output)
poetry new example
cd example/
mkdir third_party
pip3 wheel --no-deps -w third_party black
poetry add third_party/black-20.8b1-py3-none-any.whl
poetry export -o requirements.txt
poetry shell
python -m pip install -U pip==20.*
pip3 install -r requirements.txt

Actual behavior/output (1.1.0 and 1.1.2)

...
black @ third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...

Expected behavior/output (1.0.10)

...
third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...

PEP 400 expected output

...
black @ file:///third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions