Tuesday 18 March 2008 — This is over 17 years old. Be careful.
One of the side-effects of going to PyCon is getting immersed in some side project or other. Being immersed in all things Python for a few days away from the other usual complexities of life makes it a natural environment in which to dive deep.
This PyCon, I was ignited by a comment Matt Harrison made about there not being a tool to find code paths in Python. Having wrestled with the difficulty of analyzing Python code for coverage.py, I thought I could hack something together.
A few days later, the meager result is codepaths.py. It’s a command line script. Give it a Python source file, and it will report on the McCabe complexity measure of the functions and class methods within. The -m option is a minimum complexity measure below which functions are too uninteresting to include in the output (default 2). The -d option causes the output to be a Graphviz dot file for drawing the code path graphs. Without -d, the names and complexity measures are simply listed.
This will make a PNG file, for instance:
python codepaths.py -d mycode.py | dot -Tpng -o mycode.png
Weaknesses:
It’s a quick hack starting point. If people are interested, it will go some place. If not, it was a fun weekend project.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4