This is a Python debugger which instruments the abstract syntax tree to record the value of expressions in a function call and lets you easily view them after the function exits. For example:
Rather than stepping through lines, move back and forth through loop iterations and see how the values of selected expressions change:
See which expressions raise exceptions, even if they're suppressed:
Expand concrete data structures and objects to see their contents. Lengths and depths are limited to avoid an overload of data.
Calls are organised into functions (which are organised into files) and organised by time, letting you see what happens at a glance:
Simply pip install birdseye
.
Currently only Python 3.5 is supported. Python 3.4 or 3.6 might work but I haven't tested them.
For a quick demonstration, copy this example and run it. Then continue from step 2 below.
To debug your own function, decorate it with an instance of birdseye.BirdsEye
, e.g.
from birdseye import BirdsEye
@BirdsEye()
def foo():
- Call the function.
- Run
birdseye
orpython -m birdseye
. - Open http://localhost:7777 in your browser
- Click on:
- The name of the file containing your function
- The name of the function
- The most recent call to the function
- Hover over an expression to view its value at the bottom of the screen.
- Click on an expression to select it so that it stays in the inspection panel, allowing you to view several values simultaneously and expand objects and data structures. Click again to deselect.
- Click on the arrows next to loops to step back and forth through iterations. Click on the number in the middle for a dropdown to jump straight to a particular iteration. Note that data is only kept for the first and last few iterations of a loop.
Data is kept in a SQL database. You can configure this by setting the environment variable BIRDSEYE_DB
. The default is sqlite:///$HOME/.birdseye.db
.