From: W. Trevor King Date: Thu, 30 Sep 2010 17:38:22 +0000 (-0400) Subject: Migrated my depgraph page from my unversioned homepage to this blog. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=734ecea56a1c2d4dfb1b15d9060caba65f87507b;p=blog.git Migrated my depgraph page from my unversioned homepage to this blog. --- diff --git a/local.css b/local.css index 718f25f..0d6b349 100644 --- a/local.css +++ b/local.css @@ -16,6 +16,11 @@ body { background: #e7e7e7; } .actions ul { border: none; padding-bottom: 0px; font-family: sans-serif;} #footer { border: none; font-family: sans-serif;} +.scaled { + width: 100%; + height: auto; +} + .sidebar { border: solid; border-width: 1px; diff --git a/posts/depgraph.mdwn b/posts/depgraph.mdwn new file mode 100644 index 0000000..098a88c --- /dev/null +++ b/posts/depgraph.mdwn @@ -0,0 +1,47 @@ +This set of scripts scans a Python file for module dependencies, and +generates code for [Graphviz dot][graphviz]. + +Originally by Toby Dickenson. Good for giving you the "long view" on +how your project is organized. I've [altered][] the [originals][] a +bit. + +My `py2depgraph` also prints out path information for each module, so +that you can show or hide module nodes based on those paths. For +example, ignoring system modules to focus on your additions. + +My `depgraph2dot` has an added method +`depgraph2dot.invalidpath(module_name, path)` that you can override to +determine the paths you like. + +I've also added the `depgraph2dot` methods + +* `is_Cext(module_name, path)`, +* `Cext_depends(module_name, path)`, +* `Cext_edge_attributes(module_name, Cext_name)`, +* `Cext_node_attributes(Cext_name)`, and +* `Cext_depcolor(Cext_name)` + +to detect and configure the shared C libraries extending Python, so +you know where to look for the code your Python depends on. + +As example, here is the depgraph of my protein unfolding program [unfold.py][] + + $ python py2depgraph.py unfold.py | python depgraph2dot.py | dot -T png -o depgraph.png + +with standard python modules in orange, +python packages in hash-based colors, +and C extension modules in light blue. +Again, these are only the files containing either `wking` or `comedi` +in their paths. + +[[!img depgraph.png class="scaled" + alt="unfold.py dependency graph" + title="unfold.py dependency graph"]] + +[graphviz]: http://www.graphviz.org +[altered]: http://www.physics.drexel.edu/~wking/code/git/git.php?p=depgraph.git +[originals]: http://tarind.com/depgraph.html +[unfold.py]: http://www.physics.drexel.edu/~wking/code/git/git.php?p=unfold_protein.git + +[[!tag tags/tools]] +[[!tag tags/programming]] diff --git a/posts/depgraph/depgraph.png b/posts/depgraph/depgraph.png new file mode 100644 index 0000000..7f2c5af Binary files /dev/null and b/posts/depgraph/depgraph.png differ