Documentation
README
Python Debugger (pdb + debugpy)
Overview
Three tools, picked by situation:
| Tool | When |
|---|---|
breakpoint() + pdb |
Local, interactive, simplest. Add breakpoint() in source, run, get REPL. |
python -m pdb |
Launch script under pdb with no source edits. |
debugpy |
Remote / headless / attach to running process. DAP, scriptable. |
Start with breakpoint(). It's the cheapest thing that works.
When to Use
- A test fails and the traceback doesn't reveal why a value is wrong
- You need to step through a function and watch a collection mutate
- A long-running process misbehaves and you can't restart it
- Post-mortem: an exception fired and you want to inspect locals at crash site
- A subprocess is the actual bug site
This is the opening of the README. Read the full README on GitHub.