Stress-Free Debugging in Python

Dorian Puła

Software Development Engineer @ Points

@dorianpula

Who Am I?

Debug All the Things!

  1. print() All the Things!
    • Pepper code with print() + Guessing games
  2. Use the IDE! Maybe...
    • Fragile + Not always available
  3. PDB
    • The right way + but UNIX beard required

Debugging the IPython Way!!

IPython + PDB = ❤

Installing ipdb

pip install ipdb

Setting a Breakpoint

import ipdb
ipdb.set_trace()

-- or --

import ipdb; ipdb.set_trace()

Live Demo

General Commands

Running Code Directly

import ipdb
ipdb.run('object.function(2)')

Using ipdb Everywhere

Adding to virtualenvwrapper

.virtualenvs/postmkvirtualenv

pip install ipython
pip install ipdb

More About ipdb + IPython

Thank You!