Trace the local context of a Python function's execution. You can step through any function's execution, viewing the values of all local variables at every step.
All this by just adding a decorator to your function!
Install the lib:
pip install execution-trace
Annotate the function you want to trace.
from execution_trace.record import record def foo(x, y): a = x + y return a
You can also record multiple executions of the function, by passing in a parameter:
Run your code as you normally would. You'll get a message such as:
INFO:execution_trace.record:Will record execution of foo in /tmp/record_a0nQs5.json . Use `view_trace /tmp/record_a0nQs5.json` to view it.
View the trace using the supplied viewer:
Use the up/down arrow keys or the vertical scroll to step through the program's execution. Change between function executions using the number input on the right.
No need to worry about performance - the instrumentation overhead is present only for the number of executions that you want recorded. Once the data was gathered, only the original version of your code is run.
Can only trace a function at a time.
No work was done to support multithreading at this point.