mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / call_graph.mdwn
1 [[!template id=gitrepo repo=call_graph]]
2
3 This script scans a Python file for function dependencies, and
4 generates code for [Graphviz dot][graphviz].  See [[depgraph]] for
5 scripts to generate dependency graphs *between* modules.
6
7 Originally by [Prashantha Ellina][original], the [script][call_graph]
8 is good for giving you the "short view" for restructuring a single
9 module.
10
11 [[!template id=gitrepo repo=calibrate_cantilever]]
12
13 As example, here is the callgraph of my cantilever calibration program
14 `calibrate_cantilever.py`.
15
16     $ python construct_call_graph.py -i calibrate_cantilever.py | dot -T png -o call_graph.png
17
18 [[!img call_graph.png class="scaled"
19   alt="calibrate_cantilever.py call graph"
20   title="calibrate_cantilever.py call graph"]]
21
22 [graphviz]: http://www.graphviz.org
23 [original]: http://blog.prashanthellina.com/2007/11/14/generating-call-graphs-for-understanding-and-refactoring-python-code/
24
25 [[!tag tags/programming]]
26 [[!tag tags/python]]
27 [[!tag tags/tools]]