JupyterCon 2023

The Spyder debugger: An interactive debugger based on Jupyter technologies
05-11, 15:30–16:00 (Europe/Paris), Louis Armand 2

One of the main features of scientific programming is its exploratory nature: starting from some input data, the goal is to analyze it in order to understand what it can tell us about the phenomena that generated it. However, the means to do this are often unclear, and the results unforeseen. That is why this type of programming requires tools for rapid, interactive prototyping that allow users to seamlessly switch solutions to tackle the problem at hand. Unfortunately, it is not possible to follow the same approach while debugging, because traditional debuggers are mostly focused on letting users explore the call stack and state of variables, and have limited capabilities to run code.

Spyder, a community developed, open source IDE written in and for Python, aims to bridge the gap in that area. It blends the debugger with the interpreter to allow data exploration at any point during code execution, not just at the end. For that, Spyder's debugger attempts to offer the same functionality as a full IPython interpreter, so that its users can debug their code in the same way they are used to doing the rest of their scientific programming.

In this talk, I will cover the debugger features available in Spyder 5, as well as those planned for future versions. Specifically, I will present a live demo to showcase the following features (described in depth in this blog post and the Spyder documentation):

  • How to start the debugger and set breakpoints.
  • How to better understand the code at a certain frame by writing code snippets in the debugger itself, facilitated by syntax highlighting, code completion, multi-line editing and command history.
  • How to move up and down in the call stack to explore other frames in the same way.
  • How to use Spyder's Variable Explorer to browse the contents of objects.
  • How to generate Matplotlib plots while in the debugger.
  • How to use IPython magics while debugging to profile code using %timeit, explore the filesystem with %cd and %ls, and open files with %edit.

Thanks to these improvements, Spyder transforms debugging from a task that feels foreign to scientific programming, to be almost second nature. By adding breakpoint calls or setting breakpoints in the debugger, users can easily prototype different solutions for their problems at any point during code execution, and not just at end. This also increases programming speed by allowing to constantly check the correctness of code during development.

At the end of this talk, I hope attendees will learn that they don't need resort to print() or other workarounds to debug their code. Instead, they can rely on the robust debugging methods used by professional developers, supported by the interactivity and workflow they're familiar with in IPython/Jupyter.

I'm the Spyder lead maintainer, a role I've been doing for almost ten years now. I'm also part of the Jupyter Kernels council. During the last four years I worked at Quansight, leading a team that maintained Spyder, and before that at Anaconda for three years, creating packages for the Anaconda distribution and also working with a small team to improve Spyder.