[BangPypers] Tools/libraries to determine the call graph(call flow) of an python program (module/package)

Noufal Ibrahim KV noufal at nibrahim.net.in
Tue Jan 12 07:48:35 EST 2016

On Tue, Jan 12 2016, ashish makani wrote:

> thanks & true Noufal, but 2 points :
> 1. i imagine this is a fairly common usecase
> you are given some source python codebase , X which is moderately complex
> i just want to give X & some typical args which X takes, to a
> tool/library, so i get a visual, rough understanding of the typical
> call flow when X is run.  As in, i dont want to instrument or
> "decorate" the python codebase X, treat X as a blackbox what say ?

That makes sense. The trace[1] module, which, I must confess, is new to me,
mentioned by Vasudev looks like exactly what you need. It should be
simple to instrument your code with that module, get the call graph and
then use graphviz or some similar tool to draw a picture of it. 

> 2. it seems like some easy to use library is out there which spits out
> that pretty visual call flow diagram/graph which seems more
> intuitive(though maybe less precise ?) than a text call stack

Of course. Different strokes for different folks. 


[1]  https://pymotw.com/2/trace/


More information about the BangPypers mailing list