Skip to content

Python Development Tooling How-To Guides

Practical guides for accomplishing specific tasks with Python development tools like uv, ruff, and pytest.

Pages are grouped by task below. Pick a group, scan the titles, and jump to the one you need.

Installation & Setup

Install uv, Python, and ML packages on every platform

How to add Python to your system path with uv

Make uv-installed Python versions globally accessible on your system PATH.

How to Install bitsandbytes

Install bitsandbytes for quantized LLM inference, with the correct CUDA backend, using pip, uv, or conda.

How to Install DeepSpeed

Install Microsoft's DeepSpeed distributed training library, handling its JIT-compiled CUDA ops and system dependencies.

How to Install Flash-Attention

Install flash-attn without waiting hours for a CUDA compilation, using prebuilt wheels or conda-forge.

How to Install llama-cpp-python

Install llama-cpp-python with GPU acceleration for CUDA or Metal, using prebuilt wheels or compiling from source.

How to install Python CLI tools without Python

Install any Python CLI tool from PyPI without a local Python or uv installation using uvx.sh.

How to install Python with uv

Install and manage Python versions using uv, which downloads interpreters automatically when needed.

How to Install PyTorch with uv

Configure uv to install the correct PyTorch build for your hardware, whether you need CUDA, ROCm, or CPU-only wheels.

How to Install RAPIDS with uv

Configure uv to install NVIDIA RAPIDS libraries like cuDF and cuML with the correct CUDA version for your system.

How to Install Triton

Install OpenAI's Triton GPU compiler as a PyTorch dependency or standalone package on Linux.

How to install uv

Install uv, the fast Python package manager, on macOS, Linux, or Windows. Which method to use, when to skip pip, and how to fix `uv: command not found`.

How to install uv on Linux

Install uv on Linux using the standalone installer, Homebrew, or pip.

How to install uv on macOS

Install uv on macOS using the standalone installer, Homebrew, or pip.

How to install uv on Windows

Install uv on Windows using the standalone installer, WinGet, Scoop, or pip.

How to Install xformers

Install Meta's xformers library with the correct PyTorch and CUDA versions using pip, uv, or conda-forge.

Editors & AI Assistants

Configure VS Code, Cursor, Claude Code, Codex, and Copilot

Migration

Move existing projects from older tools to uv, ty, and pyproject.toml

Daily Workflow

Run, lock, upgrade, and manage day-to-day work in a uv project

How to change the python version of a uv project

Update the Python version for a uv project by editing pyproject.toml or pinning with .python-version.

How to customize uv's virtual environment location

Override the default .venv location for uv projects using command flags or environment variables.

How to require a virtualenv when installing packages with pip?

Configure pip to refuse package installation outside a virtual environment using PIP_REQUIRE_VIRTUALENV.

How to Run a Jupyter Notebook with uv

Launch Jupyter notebooks in isolated uv environments with automatic dependency management.

How to Run a Python REPL with uv

Start an interactive Python REPL session using uv run python.

How to run the IPython shell in your uv project

Use IPython in a uv project without adding it as a permanent dependency.

How to set up a Python monorepo with uv workspaces

Configure uv workspaces to manage multiple Python packages in a single repository with shared dependencies and a unified lockfile.

How to Set Up Auto-Reload for Python Projects

Practical instructions for enabling automatic code reloading in Django, Flask, FastAPI, generic scripts, and IPython.

How to upgrade uv

Update uv to the latest version using the method matching your original installation.

How to Use `--exclude-newer` for Reproducible Python Environments

Use uv's --exclude-newer flag to ignore package versions published after a specific date.

How to use a uv lockfile for reproducible Python environments

Create and use uv.lock to ensure identical dependency versions across machines and deployments.

How to use pip in a uv virtual environment

Add pip to a uv virtual environment when tools like Jupyter require direct pip access.

How to Use Poe the Poet as a Task Runner with uv

Set up Poe the Poet as a task runner in uv projects for common development commands.

How to use private package indexes with uv

Configure uv to install packages from private registries like AWS CodeArtifact, Google Artifact Registry, JFrog Artifactory, Azure Artifacts, and Sonatype Nexus. Handle corporate proxies and TLS certificates.

How to use uv to speed up Hatch

Configure Hatch to use uv for faster dependency resolution and installation.

How to use uv to speed up PDM

Configure PDM to use uv for faster dependency resolution and installation.

How to write self-contained Python scripts using PEP 723 inline metadata

Create Python scripts with PEP 723 inline metadata that declare their own dependencies for uv.

Testing

Run pytest with uv, parallelize, and matrix-test against Python versions

Linting, Formatting & Type Checking

Configure Ruff, ty, and mypy across new or existing projects

Packaging & Publishing

Lock, sign, scan, and publish Python packages to PyPI

CI, Hooks & Containers

Pre-commit, GitHub Actions, Docker, and CI integration

Troubleshooting

Diagnose and fix common errors with uv, pip, and pytest

Last updated on

Please submit corrections and feedback...