requirements file
A text file, usually requirements.txt, listing the packages a project needs, one per line, often pinned to exact versions.
In more detail
pip install -r requirements.txt recreates the same set of packages on any machine, and pip freeze > requirements.txt writes one from the current environment. Commit it, and never the virtual environment itself.
Examples
requests==2.32.3
certifi==2025.8.3A generated requirements.lock with a digest beside every pin, installed with --require-hashes, is the course's Python lockfile.Related terms
- pinning — Fixing an exact version or digest of something you depend on so it cannot change without you noticing.
- virtual environment — A self-contained folder with its own Python and its own installed packages, so each project's packages stay separate.
- reproducible build — A build that produces the same result every time from the same inputs.
- lockfile — A file that records the exact version of every dependency, including transitive ones, so every install gets the same set.
- pip — Python's standard package installer, which downloads packages from the Python Package Index and installs them.
- --require-hashes — A pip option that refuses to install anything not pinned to one version and matching a hash recorded in the requirements file.
Taught in
- Software Composition Analysis with Trivy — Cloud Security & DevSecOps Engineering
- Virtual Environments — Hands-on Python: Complete Video Course & Book
- pip, requirements, and installing packages — Hands-on Python: Complete Video Course & Book
- Dependency Risk And Typosquatting — Application Security & Threat Modeling for Engineers
- Lockfiles And Reproducible Builds — Application Security & Threat Modeling for Engineers