Hi,
During work on one package, I encountered a strange issue. We're building this package for multiple python versions with version dependent requirements (like importlib-resources), yet once I use pip-compile with setup.py dependencies with environment markers are entirely ignored. Is this an expected behavior, or is it a bug? In that case, is there and elegant workaround? Thanks.
Python 3.6.9 (default, Jul 2 2019, 20:43:20) [GCC 8.3.0]pip 20.1 (python 3.6)pip-compile, version 5.1.2setup.py
from setuptools import setup
setup(
name="foo", install_requires=["click", "importlib-resources;python_version<'3.7'",],
)
requirements.in
click
importlib_resources;python_version<'3.7'
$ python -m piptools compile setup.py
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile setup.py
#
click==7.1.2 # via foo (setup.py)
$ python -m piptools compile requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.in
#
click==7.1.2 # via -r requirements.in
importlib-metadata==1.6.0 # via importlib-resources
importlib-resources==1.5.0 ; python_version < "3.7" # via -r requirements.in
zipp==3.1.0 # via importlib-metadata, importlib-resources
Environment markers should be used identically from setup.py and requirements.in.
Marked dependencies are missing when using setup.py.
Hello @H00N24,
Thanks for the issue. Unfortunately, pip-tools has very basic support of setup.py. There is a fix #1042 for the environment markers, but it's still not merged since we discuss how to add full setup.py support in #908.
Hi @atugushev,
Thanks for the replay. I'm looking forward to this feature. I'll watch other threads for updates.
Most helpful comment
Hello @H00N24,
Thanks for the issue. Unfortunately,
pip-toolshas very basic support ofsetup.py. There is a fix #1042 for the environment markers, but it's still not merged since we discuss how to add fullsetup.pysupport in #908.