Generate Python requirements.txt files with presets for Django, FastAPI, Flask, Data Science, ML, LLM, testing, and CLI development. Copy-ready with version pinning options.
requirements.txt is the standard dependency specification file for Python projects. It lists the Python packages required to run the project, optionally with version constraints, enabling anyone to recreate the exact environment using pip install -r requirements.txt. This file is the Python ecosystem's equivalent of package.json (Node.js) or Gemfile (Ruby).
This tool generates properly formatted requirements.txt files with common packages for various Python project types, including version pinning best practices and dependency grouping.
| Syntax | Meaning | Example |
|---|---|---|
| package | Latest version | requests |
| package==1.2.3 | Exact version | requests==2.31.0 |
| package>=1.2.0 | Minimum version | requests>=2.28.0 |
| package>=1.2,<2.0 | Version range | requests>=2.28.0,<3.0.0 |
| package~=1.2 | Compatible release (~=1.2 means >=1.2,<2.0) | requests~=2.31 |
| package[extra] | With optional dependencies | requests[security] |
| -r other.txt | Include another requirements file | -r base.txt |
| -e ./local-pkg | Editable install from local path | -e ./my-library |
== pins an exact version (flask==2.3.0). = allows compatible releases (flask=2.3.0 allows 2.3.x but not 2.4.0). >= allows any newer version. Use == for reproducible builds, ~= for patch updates, and >= cautiously.
For applications, pin exact versions for reproducibility. For libraries, use ranges to avoid conflicts with other packages. Always use a lock file (pip-tools, poetry.lock) to capture the full dependency tree.
Use pip freeze > requirements.txt. For cleaner output without subdependencies, use pip-compile from pip-tools or pipreqs to scan imports in your code. Poetry users can export with poetry export.
Extras are optional dependencies for specific features. Specify them in brackets: fastapi[all], pytest[dev]. This installs the main package plus additional dependencies for that feature set.