Monday, July 3, 2017

Easy debug with Jupyter

Ok, there are plenty of debuggers out there, starting with ipdb. But in many cases, I'm just interested in inspecting the value of the variables of the function where the error happened. In fact, this type of post mortem debugging is very effective and I developed a package for that: jupydbg (on github)

It's really simple: first install the package (from pypi: pip install jupydbg or download from github and unzip in your pythonpath)

The first package, catch, can be used as follows:
  • import catch from the module
  • invoke the magic %%catch in your cell where an error occurs
  • selects the frame that you want to inspect
  • click on the button next to it
  • then call %eval in a next cell to inspect the data


The second package is to run unittest interactively.
import jupydbg.jupytest
then %test <the suite, case or method>





No comments:

Post a Comment