Statistics on Python code in a project
I wanted to know the number of lines of python code in my toy django project, and could not find a nice tool that would give me that on linux. "find . -name "*.py" |wc -l doesn't do the job. As lazy as I am, I wrote a crude linecount program in python. The result is lc.py.
The program takes the directory as an optional arg (defaults to current dir), finds all python programs and prints the number of lines, comments, docstrings, blank lines, classes and methods.And yes, it ignores .svn folders. :)
By no means it is tested well for its correctness, neither does it use exotic grammar parser techniques to accurately calculate the data. So, its only an approximation and slow at times.
Download it here
I wanted to know the number of lines of python code in my toy django project, and could not find a nice tool that would give me that on linux. "find . -name "*.py" |wc -l doesn't do the job. As lazy as I am, I wrote a crude linecount program in python. The result is lc.py.
The program takes the directory as an optional arg (defaults to current dir), finds all python programs and prints the number of lines, comments, docstrings, blank lines, classes and methods.And yes, it ignores .svn folders. :)
By no means it is tested well for its correctness, neither does it use exotic grammar parser techniques to accurately calculate the data. So, its only an approximation and slow at times.
Download it here
Labels: line count, python

0 Comments:
Post a Comment
<< Home