-
-
Notifications
You must be signed in to change notification settings - Fork 628
Description
Would it be possible to add support for producing requirements.txt
file which work for multiple Python versions via environment markers. The reason for the request is I'm working on a package which supports Python 2.7 and 3.4+, and we would like to include a requirements.txt
file in the repo to ensure that development/test builds are predictable and deterministic.
Environment Versions
- OS Type: Mac OS
- Python version:
$ python -V
: Python 2.7.13 - pip version:
$ pip --version
: pip 9.0.1 - pip-tools version:
$ pip-compile --version
: pip-compile, version 1.11.0
Steps to replicate
In Python 2.7 flower
has a requirement on futures
, i.e.,
echo flower > requirements.in
pip-compile requirements.in
> ...
futures==3.2.0
...
however this package does not exist for Python 3.4 which means that pip install -r requirements.txt
will fail in a Python 3.4 environment.
Expected result
It would be would be great if you could specify to pip-compile
which versions the requirements.txt
file should support, i.e.,
> pip-compile --envs py27,py34 requirements.in
...
futures==3.2.0; python_version == '2.7'
...
Note I'm actually creating this from setup.py
and thus an alternative could be to filter out the packages which aren't explicitly mentioned in install_requires
. I'm primarily using the requirements as part of tox
, i.e.,
deps =
-rrequirements
and though I could change this to be,
commands =
pip install -e .
which is really equivalent to:
commands =
pip-compile --output-file requirements.txt setup.py
pip install -r requirements.txt
deps =
pip-compile
the process isn't deterministic (i.e., packages aren't pinned in setup.py
), which is potentially problematic from a repeatability standpoint.