poetry export -f requirements.txt adds extras to the extras.
See original GitHub issue- 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).
- OS version and name: Mac 10.14.5, Ubuntu 19.04 (Docker)
- Poetry version: 1.0.0b1
Issue
When you have a dependency with extra’s in your pyproject.toml and you export it to a requirements.txt file the extras argument get’s added to the dependency itself:
pyproject.toml
django-anymail = {version = "^6.0", extras = ["sparkpost"]}
django-phonenumber-field = {version = "^3.0", extras = ["phonenumbers"]}
Then when I do a poetry export -f requirements.txt the output is:
...
phonenumbers==8.10.17; extra == "phonenumbers" \
--hash=sha256:b913023be4f99a210038efd3cef5212b3d11fdf7829a0b75a0031cff3eae2d9e \
--hash=sha256:e9752dda6abb076d528d954d16c8bc7f8682df6f42c837862d0dea88c7667908
...
sparkpost==1.3.6; extra == "sparkpost" \
--hash=sha256:75d1a408c7a581377ac9cc2cfef1de1249e49cb631921033cc3ff115b08c2c81 \
--hash=sha256:abaf5045d04d821f9c29c965d97173f52f6acc2051debca6f122ea7456cc1733
...
Which then when I try to pip install it results in:
Ignoring phonenumbers: markers 'extra == "phonenumbers"' don't match your environment
Ignoring sparkpost: markers 'extra == "sparkpost"' don't match your environment
This does not happen in 1.0.0a5, so I reverted back for now.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Commands | Documentation | Poetry - Python dependency ...
This command exports the lock file to other formats. poetry export -f requirements.txt --output requirements.txt. Note. This command ...
Read more >poetry-plugin-export - PyPI
The plugin provides an export command to export to the desired format. poetry export -f requirements.txt --output requirements.txt.
Read more >poetry export — Tuto Python
This command exports the lock file to other formats. ... Only the 'requirements.txt' format is currently supported. Options ¶. --format ...
Read more >Possibility to export poetry extras (#5) · Issues · to be continuous ...
Description Currently poetry support only uses poetry export to generate a requirements.txt, without the option of specifying which "extras" to load....
Read more >Integrating Python Poetry with Docker - Stack Overflow
RUN poetry export -f requirements.txt | /venv/bin/pip install -r ... because I do not need to add some extra packages to install Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did a lot of thinking on this.
The extras are just there to tell the package which other optional dependencies to install and let the package decide on the versions.
But when installing from the lock file or exported requirements.txt it should be ignored because those optional dependencies are already resolved and added, so the extra’s should just be removed.
As a fix for now I moved those extra dependencies to my own pyproject.toml file, but this means I need to manage those myself when the main package updates.
FWIW, this still appears to be an issue in 1.0.0b3