Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-compile with setup.py does not include dependencies with environment markers #1139

Closed
H00N24 opened this issue May 7, 2020 · 2 comments · Fixed by #1311
Closed

pip-compile with setup.py does not include dependencies with environment markers #1139

H00N24 opened this issue May 7, 2020 · 2 comments · Fixed by #1311
Labels
bug Something is not working markers Related to environment markers setuptools Related to compiling requirements form setup.py

Comments

@H00N24
Copy link

H00N24 commented May 7, 2020

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'
$ 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

Expected result

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

Actual result

Marked dependencies are missing when using setup.py.

@atugushev atugushev added bug Something is not working setuptools Related to compiling requirements form setup.py markers Related to environment markers labels May 16, 2020
@atugushev
Copy link
Member

atugushev commented May 16, 2020

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.

@H00N24
Copy link
Author

H00N24 commented May 18, 2020

Hi @atugushev,
Thanks for the replay. I'm looking forward to this feature. I'll watch other threads for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working markers Related to environment markers setuptools Related to compiling requirements form setup.py
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants