Debug with pdb
Start script under the Python debugger
python3 -m pdb script.py
- tool
- python15 commands
More python commands
-
breakpoint() # Python 3.7+ — drops into pdb at this lineBuilt-in breakpoint() is equivalent to import pdb; pdb.set_trace()
-
pytest -x -v --tb=short tests/Stop at first failure, verbose, short traceback
-
python3 -m py_compile script.py && echo OKCompile to bytecode only to catch syntax errors
-
black --check --diff . && black .Preview changes then apply Black formatting
-
ruff check . --fixFast linter + auto-fix (replaces flake8, isort, pyupgrade)