IPython 8.4.0 Pypi GitHub Homepage
Other Docs

To remove in the future –– IPython.core.debugger

Pdb debugger class.

This is an extension to PDB which adds a number of new features. Note that there is also the IPython.terminal.debugger class which provides UI improvements.

We also strongly recommend to use this via the ipdb package, which provides extra configuration options.

Among other things, this subclass of PDB:

  • supports many IPython magics like pdef/psource

  • hide frames in tracebacks based on :None:None:`__tracebackhide__`

  • allows to skip frames based on :None:None:`__debuggerskip__`

The skipping and hiding frames are configurable via the skip_predicates command.

By default, frames from readonly files will be hidden, frames containing __tracebackhide__=True will be hidden.

Frames containing __debuggerskip__ will be stepped over, frames who's parent frames value of __debuggerskip__ is True will be skipped.

>>> def helpers_helper():
...     pass
...
... def helper_1():
...     print("don't step in me")
...     helpers_helpers() # will be stepped over unless breakpoint set.
...
...
... def helper_2():
...     print("in me neither")
...

One can define a decorator that wraps a function between the two helpers:

>>> def pdb_skipped_decorator(function):
...
...
...     def wrapped_fn(*args, **kwargs):
...         __debuggerskip__ = True
...         helper_1()
...         __debuggerskip__ = False
...         result = function(*args, **kwargs)
...         __debuggerskip__ = True
...         helper_2()
...         # setting __debuggerskip__ to False again is not necessary
...         return result
...
...     return wrapped_fn

When decorating a function, ipdb will directly step into bar() by default:

>>> @foo_decorator
... def bar(x, y):
...     return x * y

You can toggle the behavior with

ipdb> skip_predicates debuggerskip false

or configure it in your .pdbrc

License

Modified from the standard pdb.Pdb class to avoid including readline, so that the command line completion of other programs which include this isn't damaged.

In the future, this class will be expanded with improvements over the standard pdb.

The original code in this file is mainly lifted out of cmd.py in Python 2.2, with minor changes. Licensing should therefore be under the standard Python terms. For details on the PSF (Python Software Foundation) standard license, see:

https://docs.python.org/2/license.html

All the changes since then are under the same license as IPython.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/debugger.py#0
type: <class 'module'>
Commit: