Sets up Python projects using uv for virtual environment creation and package management. Use when setting up a Python project, creating a venv, or installing Python dependencies.
Use uv as the preferred tool for Python virtual environment creation and package management instead of raw pip or python -m venv.
Ensure uv is installed:
brew install uv
uv venv --python=3.12 .venv
source .venv/bin/activate
Use uv pip install instead of pip install:
uv pip install -e '.[all]' # editable install with all extras
uv pip install -e 'packages/foo' # editable install of a sub-package
uv pip install requests # install a single package
uv pip install -r requirements.txt # install from requirements file
uv pip install hatch pytest ruff # or whatever the project uses
uv pip install rather than bare pip install when inside a uv-created venv.uv venv --python=X.Y over brew install [email protected] or pyenv install X.Y.pyproject.toml or setup.cfg for the minimum Python version (requires-python).[all], [dev], [test]) and install the appropriate ones.