Is there any way to tell pip to skip some setup_requires dependencies when not needed?
In my scenario, I have pytest-runner declared as a setup dependency (which is used to execute tests) in my setup.py. When I try to install my package (I.e: pip install my-package.tar.gz) it downloads pytest-runner or it fails it is not available (*).
In setup.py I have:
...
setup_requires=['pytest-runner', 'flake8']
...
I would like to tell setup.py only to use pytest-runner only when executing tests. Is that possible?
As @deceze suggested, this declaration will work:
setup_requires=['pytest-runner', 'flake8'] if 'test' in sys.argv else []
But I don't want to add logic to setup.py.
(*) The environment is very restricted, that's why downloading a dependency is a roadblock.