Pantograph is a framework for dynamic analysis of a Python interpreter. It allows users to reconstruct source code and program dependence graph from Jupyter notebooks, Python shell, and Python scripts.
To install Pantograph, run the following command (Python 3.5+ recommended):
git clone git@github.com:breandan/pantograph.git && cd pantograph && pip install .
Arbitrary dataflow can be recovered by passing variables to Pantograph like so:
z = 'Hello '
y = ' Pantograph '
a = z + y + '!'
p = PGraph(a, z, y)
For more details, check out the Jupyter notebook.
PDG visualization is made possible by pydot.