Set breakpoint in code

Built-in breakpoint() is equivalent to import pdb; pdb.set_trace()

breakpoint() # Python 3.7+ — drops into pdb at this line

tool
python15 commands
tags
pythondebug

More python commands

  • pytest -x -v --tb=short tests/

    Stop at first failure, verbose, short traceback

  • python3 -m py_compile script.py && echo OK

    Compile to bytecode only to catch syntax errors

  • black --check --diff . && black .

    Preview changes then apply Black formatting

  • ruff check . --fix

    Fast linter + auto-fix (replaces flake8, isort, pyupgrade)

  • mypy --strict --ignore-missing-imports src/

    Strict static type checking for a package

all 15 python commands