Dependency Management
Manage project dependencies with pip and requirements files.
What is pip?
`pip` is the standard package manager for Python. You use it to install libraries from the Python Package Index (PyPI).
Installing packages
# Install a package (e.g., Django)
pip install Django
# Install a specific version
pip install Django==5.0.6
Freezing Requirements
A `requirements.txt` file lists all the packages your project needs. This allows other developers (or your server) to install the exact same dependencies.
Creating and using requirements.txt
# Generate a requirements.txt file from your current environment
pip freeze > requirements.txt
# Install all packages from a requirements.txt file
pip install -r requirements.txt
Using UV
`uv` is an extremely fast Python package installer, written in Rust. It can be used as a drop-in replacement for `pip` for faster installs.
Installing with uv
# Install all packages from a requirements.txt file using uv
uv pip install -r requirements.txt