{
  "name": "Jupyter notebook debugging routes compared",
  "description": "Original comparison of four ways to debug a Jupyter notebook (the %debug magic, the %pdb magic, breakpoint(), and the JupyterLab visual debugger), compiled from the JupyterLab, IPython and Python pdb documentation: how each is started and what the documentation says about kernel requirements and when it applies.",
  "page": "https://casrai.org/guides/jupyter-notebook-debugging",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-14T14:04:11Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Route",
      "unit": "",
      "description": ""
    },
    {
      "name": "How it is started",
      "unit": "",
      "description": ""
    },
    {
      "name": "Kernel requirement stated in documentation",
      "unit": "",
      "description": ""
    },
    {
      "name": "When it applies",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Route": "%debug (post-mortem)",
      "How it is started": "Run %debug with no argument in the cell after an exception",
      "Kernel requirement stated in documentation": "None beyond IPython",
      "When it applies": "Works only on the last traceback that occurred"
    },
    {
      "Route": "%pdb on",
      "How it is started": "Run %pdb on (or 1); %pdb off or 0 to disable; no argument toggles",
      "Kernel requirement stated in documentation": "None beyond IPython",
      "When it applies": "Opens pdb after the traceback when an exception is triggered"
    },
    {
      "Route": "breakpoint()",
      "How it is started": "Add the call to the code and run the cell",
      "Kernel requirement stated in documentation": "None (Python built-in)",
      "When it applies": "Stops at a chosen line; documented as the replacement for import pdb; pdb.set_trace()"
    },
    {
      "Route": "JupyterLab visual debugger",
      "How it is started": "Toggle the bug icon, click the gutter to set a breakpoint, run the cell",
      "Kernel requirement stated in documentation": "A kernel with debugging support (xeus-python, xeus-robot, ipykernel, common-lisp-jupyter)",
      "When it applies": "Stops at gutter breakpoints; shows variables, call stack, breakpoints and sources in panels"
    }
  ],
  "sources": [
    {
      "title": "JupyterLab documentation: Debugger",
      "url": "https://jupyterlab.readthedocs.io/en/stable/user/debugger.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "IPython documentation: Built-in magic commands",
      "url": "https://ipython.readthedocs.io/en/stable/interactive/magics.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "Python documentation: pdb",
      "url": "https://docs.python.org/3/library/pdb.html",
      "accessed": "2026-11-14"
    }
  ]
}