Table of Contents
pip-tools
requirements.in
pip install pip-tools
Prepare requirements.in
Example
cat requirements.in pytest >= 1.4 requests
pip-compile requirements.in
cat requirements.txt # # This file is autogenerated by pip-compile # To update, run: # # pip-compile requirement.in # attrs==19.3.0 # via pytest certifi==2019.11.28 # via requests chardet==3.0.4 # via requests idna==2.8 # via requests more-itertools==8.2.0 # via pytest packaging==20.1 # via pytest pluggy==0.13.1 # via pytest py==1.8.1 # via pytest pyparsing==2.4.6 # via packaging pytest==5.3.5 requests==2.22.0 six==1.14.0 # via packaging urllib3==1.25.8 # via requests wcwidth==0.1.8 # via pytest
The generated file is pinned.
pip install -r requirements.txt
pip-tools
$ <venv>/bin/pip install pip-tools $ <venv>/bin/pip-compile --output-file requirements.txt requirements.in
update versions
- Edit requirements.in if needed.
- Run pip-compile again, exactly as before:
$ <venv>/bin/pip-compile --output-file requirements/dev.txt requirements.in/dev.txt
hash
pip-compile --quiet \ --generate-hashes \ --output-file=requirements.txt \ requirements.in
ref
Using pip-tools to manage my Python dependencies https://alexwlchan.net/2017/10/pip-tools/
RIP Pipenv: Tried Too Hard. Do what you need with pip-tools. https://medium.com/telnyx-engineering/rip-pipenv-tried-too-hard-do-what-you-need-with-pip-tools-d500edc161d4
Better Python Dependency Management with pip-tools https://www.caktusgroup.com/blog/2018/09/18/python-dependency-management-pip-tools/
Further reading: conda pip
Why You Need Python Environments and How to Manage Them with Conda https://www.freecodecamp.org/news/why-you-need-python-environments-and-how-to-manage-them-with-conda-85f155f4353c/
Reproducible and upgradable Conda environments: dependency management with conda-lock https://pythonspeed.com/articles/conda-dependency-management/