Easily debug Python apps with IPython

November 08, 2018

You can easily debug any python app by adding two lines of code that simply adds a "breakpoint" that embeds the IPython interpreter.

It's simple, install IPython and then add:

import IPython

wherever you want to start debugging. This can be useful for breakpointing without using a full IDE like PyCharm, PyDev, etc... You can then inspect the variables, scope, and run commands to test whatever.

See IPython.terminal.embed.embed docs for more information

It's very useful for web apps if you don't have a server that does it for you (like werkzeug).

Now go start debugging!