-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
160 lines (156 loc) · 7.14 KB
/
index.html
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
153
154
155
156
157
158
159
160
<?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.10: 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 class="document" id="snakefood-python-dependency-graphs">
<h1 class="title">snakefood: Python Dependency Graphs</h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#description" id="id1">Description</a><ul>
<li><a class="reference internal" href="#tools-included" id="id2">Tools Included</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dependencies" id="id3">Dependencies</a></li>
<li><a class="reference internal" href="#documentation" id="id4">Documentation</a></li>
<li><a class="reference internal" href="#download" id="id5">Download</a></li>
<li><a class="reference internal" href="#links" id="id6">Links</a></li>
<li><a class="reference internal" href="#copyright-and-license" id="id7">Copyright and License</a></li>
<li><a class="reference internal" href="#author" id="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" id="description">
<h1><a class="toc-backref" href="#id1">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" id="tools-included">
<h2><a class="toc-backref" href="#id2">Tools Included</a></h2>
<ol class="arabic">
<li><p class="first"><tt class="docutils literal">sfood</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">dot</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 external" href="/snakefood/doc/snakefood-doc.html">full documentation</a> for more
details.</p>
</div>
</div>
<div class="section" id="dependencies">
<h1><a class="toc-backref" href="#id3">Dependencies</a></h1>
<ul class="simple">
<li>Python 2.5 or higher. That's it.</li>
</ul>
</div>
<div class="section" id="documentation">
<h1><a class="toc-backref" href="#id4">Documentation</a></h1>
<ul class="simple">
<li><a class="reference external" href="CHANGES">CHANGES</a></li>
<li><a class="reference external" href="TODO">TODO</a></li>
<li><a class="reference external" href="/snakefood/doc/snakefood-doc.html">User's Manual</a></li>
<li><a class="reference external" href="/snakefood/doc/examples/">Example Outputs</a></li>
</ul>
</div>
<div class="section" id="download">
<h1><a class="toc-backref" href="#id5">Download</a></h1>
<p>A Mercurial repository can be found at:</p>
<blockquote>
<a class="reference external" href="http://bitbucket.org/blais/snakefood">http://bitbucket.org/blais/snakefood</a></blockquote>
</div>
<div class="section" id="links">
<h1><a class="toc-backref" href="#id6">Links</a></h1>
<ul class="simple">
<li><a class="reference external" href="http://www.mydarc.de/dl9obn/programming/python/dottoxml/">dottoxml</a>, a tool
by Dirk Bächle, that converts dot files into yEd inputs, useful for
large graphs.</li>
</ul>
</div>
<div class="section" id="copyright-and-license">
<h1><a class="toc-backref" href="#id7">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 external" href="COPYING">GNU General Public License</a>;</p>
</div>
<div class="section" id="author">
<h1><a class="toc-backref" href="#id8">Author</a></h1>
<p>Martin Blais <<a class="reference external" href="mailto:blais@furius.ca">blais@furius.ca</a>></p>
</div>
</div>
</body>
</html>