The Python requirements.txt Builder turns a project type into a ready-to-install, version-pinned requirements.txt. Pick web API, data science, machine learning, CLI or scraping, and the tool emits the core libraries that project type actually uses — pinned for reproducible installs.
How it works
Each archetype maps to a curated set of packages with sensible recent versions. The tool renders one name==version or name~=version line per dependency, where the operator is either == for an exact pin or ~= for a compatible-release pin. Exact pins reproduce a build byte-for-byte; compatible-release pins like requests~=2.32.3 allow later patch versions (2.32.x) while blocking a minor bump that might break you. Optional development tools — pytest, ruff, mypy — are appended under a comment so you can split them into a requirements-dev.txt later.
Pinning notes
Pinning matters because, without it, pip installs whatever is newest at install time, so two deploys weeks apart can ship different code. Pins make the same versions land in CI, Docker and on your laptop. Direct pins do not freeze transitive dependencies though — for that, compile a lock file:
pip install pip-tools
pip-compile requirements.in # produces a fully pinned requirements.txt
Project types and their core libraries
Each archetype includes the libraries you genuinely need for that type of project, not everything you might conceivably use.
Web API includes a web framework (such as FastAPI or Flask), an ASGI/WSGI server for production, database access (SQLAlchemy or similar), and a validation layer. The goal is a server you can deploy to a production host immediately.
Data science centres on the scientific Python stack — numerical arrays, data frames, plotting — plus a notebook environment. Libraries are pinned conservatively because NumPy and pandas have binary compatibility constraints between their own versions.
Machine learning adds a deep learning framework and training utilities on top of the data science base. Note that GPU-accelerated versions of PyTorch or TensorFlow have separate install instructions that require matching CUDA versions — the requirements file covers the CPU-friendly variant.
CLI tools are lighter: an argument parser, a terminal output library, and optional configuration management. These installs are typically fast and do not require native compilation.
Scraping includes an HTTP client, an HTML parser, and optionally a headless browser driver for JavaScript-rendered pages. Add rate-limiting and polite crawling practices to any scraping project.
Splitting dev dependencies
Keeping test and lint tools out of your production image reduces its size and limits exposure. The generated file marks optional dev tools with a comment; create a separate requirements-dev.txt that includes the main file and adds test tools:
# requirements-dev.txt
-r requirements.txt
pytest==8.2.0
ruff==0.4.4
mypy==1.10.0
pytest-cov==5.0.0
Install both in development with pip install -r requirements-dev.txt. The production Docker image installs only requirements.txt.
Tips
Install with pip install -r requirements.txt inside a virtual environment. The bundled versions are a starting point, not a live feed — run pip list --outdated periodically and re-pin. For new projects, consider a modern manager like uv or Poetry, which records the full resolved dependency tree automatically.