How to use breakpoint() on IPython
Since Python 3.7, the breakpoint()
call has become a handy replacement for import pdb; pdb.set_trace()
.
When you run a program normally, it will automatically stop at that line and launch the debugging console with the standard Python interpreter.
But it’s also possible to use breakpoint()
to work with IPython, which has colors and tab completion and all sort of goodies.
To do that, just export the following environment variable:
export PYTHONBREAKPOINT=ipdb.set_trace