pip-tools
pip-tools is a set of CLI tools that generate and apply fully pinned package requirement files for Python projects using pip.
Installation and Setup
Install it from PyPI:
Key Features
- Compiles fully pinned
requirements.txtfiles fromrequirements.inand can also compile from modern project metadata likepyproject.toml, including extras through--extra. - Resolves dependencies using
piptooling and generates hash-pinned outputs with--generate-hasheswhen you want stricter verification. - Controls upgrades with
--upgradefor everything and--upgrade-packagefor targeted packages. - Syncs an environment to match the compiled files and removes extraneous packages with
pip-sync. - Supports project defaults via
.pip-tools.tomlorpyproject.tomlconfiguration under[tool.pip-tools].
Usage
Create an input file that lists only your direct dependencies:
requirements.in
flask
requests
Compile a fully pinned requirements.txt file:
$ pip-compile
Install exactly what is in requirements.txt in other system or environment:
$ pip-sync
Upgrade everything to the latest compatible versions:
$ pip-compile --upgrade
$ pip-sync
Upgrade selected packages only:
$ pip-compile --upgrade-package requests
$ pip-sync
Compile from pyproject.toml and include an extra:
$ pip-compile pyproject.toml --extra dev
Related Resources
Course
uv vs pip: Python Packaging and Dependency Management
Choosing between uv vs pip? This video course compares speed, reproducible environments, compatibility, and dependency management to help you pick the right tool.
By Leodanis Pozo Ramos • Updated July 18, 2026