blog.humaneguitarist.org

discoveries in digital audio, music notation, and information encoding

making my first dependency graph

leave a comment

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 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  and depgraph2dot.py to the folder.
  3. Downloaded and installed Graphviz.
    • On my system it installed to:
      • 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 …

--------------

Related Content:

Written by nitin

May 7th, 2011 at 8:53 am

Leave a Reply

*

Switch to our mobile site