Debugging in Spyder is supported through integration with the enhanced ipdb debugger in the IPython Console. This allows breakpoints and the execution flow to be viewed and controlled right from the Spyder GUI, as well as with all the familiar IPython console commands.

A Spyder IPython console window, showing the ipdb debugger in action

Debugging with ipdb

Spyder offers the following debugging features integrated into the native GUI:

Spyder's debug menu, showing options to set, show and clear breakpoints, and control debugger execution flow
  • Multiple means of setting and clearing normal and conditional breakpoints for any line in a file opened in the Editor.

    • By selecting the respective option from the Debug menu.

    • Through pressing a configurable keyboard shortcut (F12 for normal, or Shift-F12 for conditional breakpoints by default).

    • By double-clicking to the left of the line number in an open file.

    • With an ipdb.set_trace() statement in your code (after import ing pdb).

    • Interactively, using the b command in an ipdb session.

Spyder's Breakpoints panel, with a number of examples showing file, line number and an optional condition
  • A Breakpoints pane, listing the file, line, and condition (if any) of every breakpoint defined (Debug ‣ List breakpoints, or Ctrl-Shift-B by default).

  • Full GUI control over debugger execution from the Debug menu, Debug toolbar and via configurable keyboard shortcuts, along with the standard ipdb console commands.

Inset of Spyder's Editor, with a breakpoint set and the condition dialog open
  • Highlighting of the current frame (debugging step) in the Editor.

  • The ability to access and edit local and global variables at each breakpoint through the Variable Explorer, and run many commands in the IPython Console.

For a comprehensive but accessible introduction to pdb/ipdb, consult Steve Ferg’s excellent online guide, Debugging in Python.