Skip to content
cheatsheet
home
/
cv
/
weblog
/
cheatsheet
/
proxy
/
vpn
/
status
/
links
EN
RU
☾
New version available
reload
×
cheatsheet
/
python
/
Debug with pdb
Debug with pdb
python
Start script under the Python debugger
python3 -m pdb script.py
⎘ copy
#python
#debug
more python
all 15 commands →
Set breakpoint in code
breakpoint() # Python 3.7+ — drops into pdb at this line
Run tests with pytest
pytest -x -v --tb=short tests/
Check syntax without running
python3 -m py_compile script.py && echo OK
Format code with black
black --check --diff . && black .
Lint with ruff
ruff check . --fix