blog.humaneguitarist.org

making my first dependency graph

[Sat, 07 May 2011 13:53:53 +0000]
I wanted a quick, easy way to generate a dependency graph for PHP include statements, but of course I actually did my Google searches for a Python dependency visualizer. The PHP can wait ... Anyway, I found this cool page [http://www.tarind.com/depgraph.html] that had some scripts that can make dependency graphs using Python import statements. In a nutshell, here's what I did. 1. Made a folder on my Desktop (I have Window 7) called "python_visualizer". 2. Downloaded py2depgraph.py [http://www.tarind.com/py2depgraph.py] and depgraph2dot.py [http://www.tarind.com/depgraph2dot.py] to the folder. 3. Downloaded and installed Graphviz [http://www.graphviz.org/Download..php]. + On my system it installed to: o C:\Program Files\Graphviz2.26.3 4. Put a copy of one of my Python scripts (renamed to "foo.py") in the "python_visualizer" folder. 5. Opened the command line and did this: $ python_visualizer>python py2depgraph.py foo.py | python depgraph2dot.py | "C:\Program Files\Graphviz2.26.3\bin\dot" -T png -o depgraph.png Now, I did get a little error message as below: (dot.exe:7244): Pango-WARNING **: couldn't load font "Helvetica Not-Rotated 10", falling back to "Sans Not-Rotated 10", expect ugly output. but it's no big deal, the PNG still got made ... and I don't think it's that ugly! But you can judge for yourself ... IMAGE: [http://blog.humaneguitarist.org/uploads/depgraph.gif]