question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation for IPython.core.debugger and IPython.terminal.debugger

See original GitHub issue

The documentation for IPython.core.debugger states that it is deprecated but it doesn’t provide any information about what should be used instead. A few questions:

  • Was IPython.core.debugger deprecated in favour of IPython.terminal.debugger?
  • If so, what should be used in jupyter notebooks (IPython.terminal.debugger.set_trace() doesn’t appear to work when used in a notebook)?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
tillahoffmanncommented, Sep 13, 2016

I now use the following in my own code to set (conditional) breakpoints.

from IPython.core.debugger import Pdb as CorePdb
import sys


def breakpoint(condition=True):
    """
    Set a breakpoint at the location the function is called if `condition == True`.
    """
    if condition:
        debugger = CorePdb()
        frame = sys._getframe()
        debugger.set_trace(frame.f_back)
        return debugger


def add(a, b):
    c = a + b
    breakpoint(a + b == 3)
    return c

add(1, 2)
0reactions
Carreaucommented, Sep 13, 2016

I would go with set_trace() for consistency with perminal and PDB itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module: core.debugger — IPython 8.7.0 documentation
This documentation covers IPython versions 6.0 and higher. ... Note that there is also the IPython.terminal.debugger class which provides UI improvements.
Read more >
Step-by-step debugging with IPython - Stack Overflow
Using IPython by embedding an IPython shell in your code. You can do from IPython import embed , and then use embed() in...
Read more >
Working with Jupyter Notebooks in Visual Studio Code
Start by setting any breakpoints you need by clicking in the left margin of a notebook cell. · Then select the Debug Cell...
Read more >
5 Ways of Debugging with IPython - Sebastian Witowski
You can always use the standard Python debugger pdb , but a much better alternative is to use IPython as your debugger.
Read more >
Errors and Debugging | Python Data Science Handbook
Code development and data analysis always require a bit of trial and error, and IPython contains tools to streamline this process. This section...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found