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 ignores setup_dependencies when parsing setup.py #825

Open
bgklein opened this issue May 24, 2019 · 11 comments
Open

Pip-compile ignores setup_dependencies when parsing setup.py #825

bgklein opened this issue May 24, 2019 · 11 comments
Labels
feature Request for a new feature needs discussion Need some more discussion

Comments

@bgklein
Copy link

bgklein commented May 24, 2019

Similar to #625 it seems that pip-compile ignores setup_dependencies when resolving dependencies. This causes a problem for us as our workflow uses pip-compile to freeze dependencies w/ hashes. Then we use the requirements files generated to pip download all dependencies prior to installing in a network isolated environment.

Environment Versions
  1. OS Type - Windows
  2. Python version: Python 3.7.1
  3. pip version: pip 18.1
  4. pip-tools version: pip-compile, version 3.7.0
Steps to replicate

pip-compile --generate-hashes --allow-unsafe --output-file test-windows.txt test.in

Where test.in contains a dependency which has setup_dependencies.

Expected result

Setup dependency to be populated in windows.txt

Actual result

Not included.

@atugushev
Copy link
Member

Hello @bgklein,

Thanks for the info! Could you paste here a content of the test.in which causes the bug?

@bgklein
Copy link
Author

bgklein commented May 24, 2019

One example is flake8==3.50 (setup_dependency of pytest-runner).
test.in.txt
test-windows.txt

@atugushev
Copy link
Member

atugushev commented May 24, 2019

I'm a little bit confused, what do you mean by setup_dependency?

@bgklein
Copy link
Author

bgklein commented May 24, 2019

Sorry my bad. put the wrong terminology. setup_requires as in https://github.com/PyCQA/flake8/blob/8acf55e0f85233c51c291816d73d828cc62d30d1/setup.py#L146

@atugushev
Copy link
Member

atugushev commented May 24, 2019

Thanks! Looks like that's a correct behaviour since packages in setup_requires are not supposed to be installed, see a note in docs:

(Note: projects listed in setup_requires will NOT be automatically installed on the system where the setup script is being run. They are simply downloaded to the ./.eggs directory if they’re not locally available already. If you want them to be installed, as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)

@bgklein
Copy link
Author

bgklein commented May 24, 2019

Hmm that makes sense. Do you know if it would be possible to make this an optional flag for pip-compile? Otherwise my team will need to add them to our requirements file/maintain them separately as our actual install happens without internet connectivity causing 'They are simply downloaded to the ./.eggs directory if they’re not locally available already' to fail.

@atugushev
Copy link
Member

You may simply add pytest-runner to the test.in. Wouldn't it be enough?

@bgklein
Copy link
Author

bgklein commented May 24, 2019

Yea it would be enough just mean more maintenance. Since we do hash checking we specify the versions of our dependencies. This means when upgrading flake8 and/or any other dependencies we will need to dive into the dependency tree to upgrade their respective setup_requires.

@atugushev
Copy link
Member

FYI there is no need to specify version in *.in file, that's not how it works. Let the pip-compile pin the packages in requirements.txt.

@bgklein
Copy link
Author

bgklein commented May 24, 2019

While pip-compile does not require pinned versions, we do pin our versioning for our core dependencies. Looking over the setup_requires for most of our dependencies it looks like none of them pin their setup_requires to a specific version so we should be able to leave them unpinned, but it does defeat some of the purpose of pinning our dependencies.

You can close the issue if you'd like, as the solution should work. I still think it'd be helpful to have a flag which would automatically get and add setup_requires as currently we either have to try to build and see failures to determine what's missing or crawl the dependency tree to realize what is in the field, but I will leave teh decision on that to you guys.

@atugushev atugushev added the feature Request for a new feature label Jun 6, 2019
@atugushev atugushev added the needs discussion Need some more discussion label Sep 19, 2019
@atugushev
Copy link
Member

FYI, refs #492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature needs discussion Need some more discussion
Projects
None yet
Development

No branches or pull requests

2 participants