I was looking around for ways to get a look at a python dependency graph, and found this site which actually does a pretty good job. The only gripe I have regards the command you must use:
python py2depgraph.py path/to/my/script.py | python depgraph2dot.py | dot -T png -o depgraph.png
Couldn't be easier, right? ...
Anyway, I added a bit of sugar on top of it.
First I put the two files they provided in ~/clone/modgraph
mkdir ~/clone/modgraph
cd ~/clone/modgraph
wget http://www.tarind.com/py2depgraph.py
wget http://www.tarind.com/depgraph2dot.py
touch ~/bin/modgraph
chmod +x ~/bin/modgraph
and then in ~/bin/modgraph
if [ -z "$2" ]
then
echo "usage: modgraph somepythonfile.py out.png"
exit
fi
python ~/clone/modgraph/py2depgraph.py $1 | python ~/clone/modgraph/depgraph2dot.py | dot -T png -o $2
And of course to use it:
modgraph myfile.py outfile.png
Is there another module that does this better? Should I package this up and throw it on pypi?