Pip-tools: pip-compile with setup.py does not include dependencies with environment markers

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

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.

Environment Versions

  1. OS Type: Ubuntu 19.10
  2. Python version: Python 3.6.9 (default, Jul 2 2019, 20:43:20) [GCC 8.3.0]
  3. pip version: pip 20.1 (python 3.6)
  4. pip-tools version: pip-compile, version 5.1.2

Steps to replicate

setup.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'
    1.
$ 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)
    2.
$ 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

Expected result

Environment markers should be used identically from setup.py and requirements.in.

Actual result

Marked dependencies are missing when using setup.py.

bug markers setuptools

Most helpful comment

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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings