Visual callgraph in Python

Sometimes a picture tells more than... Not often in programming though, but occasionally a picture does tell a little more than text and numbers can do (especially when the text and numbers are included in the picture).

Recently I found myself in need of a visual representation of a callgraph of a webapp written in Django. This was a pretty simple exercise creating a middleware that makes use of pycallgraph. The only heads-up is to make use of filters, exclude and/or include, or you'll end up with a *huge* pitcure.

I wrote a snippet to share. Using Django or not, that small piece of code shows how easy it is to make use of pycallgraph.

Basically it's just:

import pycallgraph
pycallgraph.start_trace()
call_to_the_main_code()
pycallgraph.make_dot_graph('callgraph.png')

As said I recommend making use of a filter though.


Simpycity

No, it's not the name of a game library for Python. The description from their Trac says it all:

"Simpycity is a simple mapping system for PostgreSQL stored procedures and queries, enabling easy usage of PG procedures using standard Python call semantics."

After reading Aurynn Shaw's recent blog entry about it I got very curious. The itches described in that entry looks a lot like mine.

Downloaded and played quickly with it but hasn't the time right now to really plunge into it. The idea is very tempting to me and I want to take part in pitching this. If it's as interesting and useful as I think it might be I probably will look into getting involved in it's development.


RSS 2.0