[x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
OS version and name: macOS Mojave 10.14.3
This issue seems pretty simple at the front but has caused me a bunch of grief.
TL;DR: No requirements are technically specified, and yet when I perform a basic poetry export -f requirements.txt --without-hashes > requirements.txt the following is set in the requirements.txt:
botocore==1.15.16
docutils==0.15.2
jmespath==0.9.5
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.8; python_version != "3.4"
with the folloing pyproject.toml:
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.7"
awscli = {version = "^1.18.16", optional = true}
[tool.poetry.dev-dependencies]
boto3 = "^1.12.16"
[tool.poetry.extras]
"aws" = ["awscli"]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
I have deleted the pyproject.toml and re-performed poetry update in an attempt to create a fresh poetry.lock, and yet it keeps outputting these requirements. After some experimenting, I believe this is due to those being common requirements between dev and extras. Although those shouldn't be included in a basic export, somehow their common requirements are included. I confirmed this by commenting out the extras and updating and then commenting out the dev requirements and updating and both times the requirements.txt is empty.
I believe this functionality is a bug rather than a feature request due to the inclusion of the --dev and --extras parameters in poetry export to specify all dev/extras requirements to be included.
Yep, same behaviour here. If the poetry.lock has been updated with optional dependencies, this dependencies will be in the requirements.txt. Since there is a --extras option I think it's a bug.
Another use case: I ran into this issue while trying to write some fiddly tests that inspect extras and uninstall/reinstall packages to assert about imports being tolerant to missing packages. My goal was to generate a bunch of requirements.txt for different combinations of extras, then in a shell script loop over them and:
pip install the current requirements.txtI ended up having to inspect pyproject.toml and poetry.lock myself to generate those requirements.txts. I didn't end up using export at all. :(
I'm having trouble with this as well.
Since we can't define extras using dev-dependencies, I also put these dependencies as optional, but then poetry export always adds these optional dependencies to the requirements output. I tried using -E "" to tell poetry not to include any extras, but it doesn't accept an empty value.
Related / duplicated of #1989
Most helpful comment
Yep, same behaviour here. If the
poetry.lockhas been updated with optional dependencies, this dependencies will be in therequirements.txt. Since there is a--extrasoption I think it's a bug.