Migrated my depgraph page from my unversioned homepage to this blog.
authorW. Trevor King <wking@drexel.edu>
Thu, 30 Sep 2010 17:38:22 +0000 (13:38 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 30 Sep 2010 17:38:22 +0000 (13:38 -0400)
local.css
posts/depgraph.mdwn [new file with mode: 0644]
posts/depgraph/depgraph.png [new file with mode: 0644]

index 718f25f4d19216ffed378692b5779156cfa766ec..0d6b34972a876293b1acfe8d284e69755bfea4e3 100644 (file)
--- 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 (file)
index 0000000..098a88c
--- /dev/null
@@ -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 (file)
index 0000000..7f2c5af
Binary files /dev/null and b/posts/depgraph/depgraph.png differ