Hi,
I try to use layered requirements for a development environment as instructed in the documentation, but either I understood it wrong or there's some error in it.
I created a test environment and installed pip-tools there. Next I created a small and easy setup.py which requires PyYAML for my package. pip-compile recognizes this requirement accordingly and creates a correct requirements.txt. Next I created a dev-requirements.in with -c requirements.txt at the very top of that file plus flake8. Result is that I have now a file called dev-requirements.txt containing only those python packages as dependency as of flake8.
pip-compilepip-compile dev-requirements.in#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile dev-requirements.in
#
flake8==3.8.4 # via -r dev-requirements.in
pyyaml==5.3.1 # via -c requirements.txt
mccabe==0.6.1 # via flake8
pycodestyle==2.6.0 # via flake8
pyflakes==2.2.0 # via flake8
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile dev-requirements.in
#
flake8==3.8.4 # via -r dev-requirements.in
mccabe==0.6.1 # via flake8
pycodestyle==2.6.0 # via flake8
pyflakes==2.2.0 # via flake8
The README has this example:
To sync multiple *.txt dependency lists, just pass them in via command line arguments, e.g.
$ pip-sync dev-requirements.txt requirements.txt
So I think you can run that if you want to install both sets of requirements. The -c option is just used to ensure your dev file doesn't violate the other file's constraints, but it doesn't automatically add other dependencies to its output.
Did you try using -r requirements.txt instead of -c requirements.txt in dev-requirements.in?
I'll close this based on the above correct solution from @DBCerigo, but please let us know if it doesn't resolve your issue. Thanks!
Most helpful comment
Did you try using
-r requirements.txtinstead of-c requirements.txtindev-requirements.in?