-
-
Notifications
You must be signed in to change notification settings - Fork 321
VisualizeDependencies
While trying to get a deeper understanding for the source of SCons, I actually wanted to see the classes and their dependencies. Googling around I found these two tools that could produce DOT graph files for class or import dependencies from Python source trees:
-
snakefood: Creates module import dependency graphs. Use the Mercurial command
hg clone https://hg.furius.ca/public/snakefood
for a checkout of the current sources. Note Python 3 support may be incomplete, the project seems rather inactive. - pylint: As part of pylint it analyzes class dependencies. Install using pip or distribution package manager.
Having both applications installed, I called
sfood -i . | sfood-graph > scons_import.dot
pyreverse -p scons -k .
with the SCons source directory as current folder.
Unfortunately, the resulting graphs were pretty large and visualizing them via the dot tool did not help. PNG, PS or SVG output, the images got too large and the layout of the nodes and edges left a lot to desire.
Then I remembered the yEd Graph Editor (http://www.yworks.com/en/products_yed_about.html), a great application that can layout and handle even very large datasets...if you find a way to get the data inside. Since it does not import DOT files (yet), I wrote the little converter script dottoxml.py (http://www.mydarc.de/dl9obn/programming/python/dottoxml) that outputs yEd's native file format Graphml (XML).
Now looking at complicated DOT graphs is a snap...have a try!
The following files were created with the sources for SCons 1.2.0.d20090223
and Waf 1.5.8
, they are all available in two versions:
- The nodes contain not only the class names, but also methods/attributes ("_fc" suffix) and
- class names only (no special suffix). Graphml files (XML) with dependencies that can be read directly by yEd:
-
SCons classes/packages scons_graphml.zip
-
Waf classes/packages waf_graphml.zip The original DOT files:
-
SCons classes/packages scons_dot.zip
-
Waf classes/packages waf_dot.zip