1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
<title>snakefood: Python Dependency Graphs</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="project-header">
<a href="/"><img src="/home/furius-logo-w.png" id="logo"></a>
</div>
<div id="download-link"><a href="/downloads/snakefood/">Download</a></div>
<div class="document" id="snakefood-python-dependency-graphs">
<h1 class="title">snakefood: Python Dependency Graphs</h1>
<div class="contents topic">
<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
<ul class="simple">
<li><a class="reference" href="#description" id="id2" name="id2">Description</a><ul>
<li><a class="reference" href="#tools-included" id="id3" name="id3">Tools Included</a></li>
</ul>
</li>
<li><a class="reference" href="#dependencies" id="id4" name="id4">Dependencies</a></li>
<li><a class="reference" href="#documentation" id="id5" name="id5">Documentation</a></li>
<li><a class="reference" href="#download" id="id6" name="id6">Download</a></li>
<li><a class="reference" href="#copyright-and-license" id="id7" name="id7">Copyright and License</a></li>
<li><a class="reference" href="#author" id="id8" name="id8">Author</a></li>
</ul>
</div>
<!-- 1 Description
1.1 Tools Included
2 Dependencies
3 Documentation
4 Download
5 Copyright and License
6 Author -->
<div class="section">
<h1><a class="toc-backref" href="#id2" id="description" name="description">Description</a></h1>
<p>Generate dependency graphs from Python code. This dependency tracker
package has a few distinguishing characteristics:</p>
<ul class="simple">
<li>It uses the AST to parse the Python files. This is <strong>very
reliable</strong>, it always runs.</li>
<li><strong>No module is loaded</strong>. Loading modules to figure out dependencies
is almost always problem, because a lot of codebases run
initialization code in the global namespace, which often requires
additional setup. Snakefood is guaranteed not to have this problem
(it just runs, no matter what).</li>
<li>It works on a set of files, i.e. you do not have to specify a single
script, you can select a directory (package or else) or a set of
files. It finds all the Python files recursively automatically.</li>
<li><strong>Automatic/no configuration</strong>: your PYTHONPATH is automatically
adjusted to include the required package roots. It figures out the
paths that are required from the files/directories given as input.
You should not have to setup ANYTHING.</li>
<li>It does not have to automatically 'follow' dependencies between
modules, i.e. by default it only considers the files and directories
you specify on the command-line and their immediate dependencies.
It also has an option to automatically include only the dependencies
within the packages of the files you specify.</li>
<li>It follows the UNIX philosophy of <strong>small programs that do one thing
well</strong>: it consists of a few simple programs whose outputs you
combine via pipes. Graphing dependencies always requires the user to
filter and cluster the filenames, so this is appropriate. You can
combine it with your favourite tools, grep, sed, etc.</li>
</ul>
<p>A problem with dependency trackers that run code is that they are
unreliable, due to the dynamic nature of Python (the presence of
imports within function calls and __import__ hooks makes it almost
impossible to always do the right thing). This script aims at being
right 99% of the time, and we think that given the trade-offs, 99% is
good enough for 99% of the uses.</p>
<p>I fully intend that this program work on all codebases. It has been
tested on a number of popular open source codes (see the test
directory).</p>
<div class="section">
<h2><a class="toc-backref" href="#id3" id="tools-included" name="tools-included">Tools Included</a></h2>
<ol class="arabic">
<li><p class="first"><tt class="docutils literal"><span class="pre">sfood</span></tt>:</p>
<blockquote>
<p>Given a set of input files or root directories, generate a list
of dependencies between the files;</p>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">sfood-graph</span></tt>:</p>
<blockquote>
<p>Read a list of dependencies and produce a Graphviz dot file.
(This file can be run through the Graphviz <tt class="docutils literal"><span class="pre">dot</span></tt> tool to
produce a viewable/printable PDF file);</p>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">sfood-cluster</span></tt>:</p>
<blockquote>
<p>Read a list of dependencies, a list of file clusters, and output
a list of simplified (clustered) dependencies.</p>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">sfood-checker</span></tt>:</p>
<blockquote>
<p>Analyze the source code with the AST and list unused or
redundant imports.</p>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">sfood-imports</span></tt>:</p>
<blockquote>
<p>Find and list import statements in Python files, regardless of
whether they can be imported or not.</p>
</blockquote>
</li>
</ol>
<p>See <a class="reference" href="/snakefood/doc/snakefood-doc.html">full documentation</a> for more
details.</p>
</div>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id4" id="dependencies" name="dependencies">Dependencies</a></h1>
<ul class="simple">
<li>Python 2.5 or higher. That's it.</li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id5" id="documentation" name="documentation">Documentation</a></h1>
<ul class="simple">
<li><a class="reference" href="CHANGES">CHANGES</a></li>
<li><a class="reference" href="TODO">TODO</a></li>
<li><a class="reference" href="/snakefood/doc/snakefood-doc.html">User's Manual</a></li>
<li><a class="reference" href="/snakefood/doc/examples/">Example Outputs</a></li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id6" id="download" name="download">Download</a></h1>
<ul class="simple">
<li><a class="reference" href="/downloads/snakefood/">Download</a></li>
</ul>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id7" id="copyright-and-license" name="copyright-and-license">Copyright and License</a></h1>
<p>Copyright (C) 2001-2007 Martin Blais. All Rights Reserved.</p>
<p>This code is distributed under the <a class="reference" href="COPYING">GNU General Public License</a>;</p>
</div>
<div class="section">
<h1><a class="toc-backref" href="#id8" id="author" name="author">Author</a></h1>
<p>Martin Blais <<a class="reference" href="mailto:blais@furius.ca">blais@furius.ca</a>></p>
</div>
</div>
</body>
</html>
|