Pip-tools: Preserve environment markers of indirect dependencies

Created on 1 May 2020  路  2Comments  路  Source: jazzband/pip-tools

https://github.com/jazzband/pip-tools/pull/459 ensured that environment markers for dependencies listed explicitly in requirements.in are preserved in the output requirements.txt.

This feature request is about also preserving requirement markers for indirect dependencies.

Example:

(testenv) estan@edison:~$ cat requirements.in 
pytest==5.4.1
(testenv) estan@edison:~$ pip-compile requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile requirements.in
#
attrs==19.3.0             # via pytest
importlib-metadata==1.6.0  # via pluggy, pytest
more-itertools==8.2.0     # via pytest
packaging==20.3           # via pytest
pluggy==0.13.1            # via pytest
py==1.8.1                 # via pytest
pyparsing==2.4.7          # via packaging
pytest==5.4.1             # via -r requirements.in
six==1.14.0               # via packaging
wcwidth==0.1.9            # via pytest
zipp==3.1.0               # via importlib-metadata
(testenv) estan@edison:~$

However, importlib-metadata is only a dependency of pytest and pluggy on Python < 3.8 due to them having

Requires-Dist: importlib-metadata (>=0.12) ; python_version < "3.8"

in their wheel meta data. I would therefore like the output to have

importlib-metadata==1.6.0 ; python_version < "3.8"  # via pluggy, pytest

That is, the environment marker for this indirect dependency should be preserved.

More formally:

  1. A dependency, whether direct or indirect, should always be listed in the output requirements.txt, even if the environment markers for it state that it is not needed in the environment in which pip-compile is running.

  2. In the output, the environment markers for a given dependency should be the logical or of the requirement markers encountered for that dependency in the dependency graph.

bug duplicate markers

All 2 comments

Duplicates #563.

Feel free to reopen if you think that it doesn't resolve the issue. Thanks for the report!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gwerbin picture gwerbin  路  4Comments

mosesontheweb picture mosesontheweb  路  3Comments

atugushev picture atugushev  路  5Comments

dazza-codes picture dazza-codes  路  3Comments

sirex picture sirex  路  4Comments