Spyder: Add a command to debug a single cell

Created on 18 May 2019  路  5Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x] Searched the issues page for similar reports
  • [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [ ] Could not reproduce inside jupyter qtconsole (if console-related)
  • [ ] Tried basic troubleshooting (if a bug/error)

    • [ ] Restarted Spyder

    • [ ] Reset preferences with spyder --reset

    • [ ] Reinstalled the latest version of Anaconda

    • [ ] Tried the other applicable steps from the Troubleshooting Guide

  • [ ] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

If I have cells in my code that take a long time to run, I want to avoid having to re run everything. Yet, if I want to debug just a part of my code, this is what I need to do.
It would be great to use a mechanism similar to runcell (called debugcell) to debug a single cell.

The logic is implemented in https://github.com/spyder-ide/spyder-kernels/pull/112, but I wonder if there should be a keyboard shortcut or something to trigger that from spyder.

If https://github.com/spyder-ide/spyder-kernels/pull/112 is merged, should there be a mechanism to trigger the cell debugging? For now I type debugcell('mycell') in the console.

IPython Console Enhancement

Most helpful comment

How about just a line in the menu and a keyboard shortcut?

All 5 comments

The simplest way to start debugging a cell is to put

import pdb; pdb.set_trace()

anywhere on it. I don't think we need more than that, do we?

Well you could make the same argument about debugfile. I can enter debugging without having to change my code and then remember to remove the line.

Right, but Python 3.7 makes things even easier with the breakpoint builtin. I mean, we can add the debugcell command to our kernel, but I'm -1 on adding a UI for it because it'd make our interface more complex.

How about just a line in the menu and a keyboard shortcut?

Ok, that's a good compromise.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dalthviz picture dalthviz  路  3Comments

marianux picture marianux  路  3Comments

impact27 picture impact27  路  3Comments

danieltomasz picture danieltomasz  路  3Comments

hedeqing picture hedeqing  路  3Comments