E501 line too long (> 79 characters) E231 missing whitespace after ',:' W291 trailing whitespace W293 blank line contains whitespaceIn this post we will take a look at web frameworks source code readability. The ratio between a web framework total python source lines to PEP8 errors found represents PEP8 error rate in respectful framework: source code is hosted on bitbucket, let clone it into some directory and setup virtual environment (this will download source code per framework listed above).
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/04-pep8 && make env upThe make file has a target for each metric, so in order to gather pep8 count issue make pep8, or make count to count total lines. Since some web frameworks consist of several packages (developed by the same team), I have combined them this way:
flask += jinja2 + werkzeug pyramid += chameleon + webobHere are raw numbers (as of January 21, 2013):
bottle => 6812 chameleon => 10183 cherrypy => 34117 circuits => 20947 django => 201506 flask => 11473 jinja2 => 16533 pyramid => 53205 pysi => 1177 tornado => 26675 turbogears => 10656 web2py => 109758 webob => 17336 webpy => 12685 werkzeug => 27915 wheezy.caching => 2978 wheezy.core => 3444 wheezy.html => 3469 wheezy.http => 5891 wheezy.routing => 1819 wheezy.security => 867 wheezy.template => 3309 wheezy.validation => 1957 wheezy.web => 6602 number of PEP8 errors or warnings: bottle => 757 chameleon => 266 cherrypy => 1121 circuits => 740 django => 10168 flask => 429 jinja2 => 406 pyramid => 3544 pysi => 184 tornado => 301 turbogears => 655 web2py => 7975 webob => 1398 webpy => 855 werkzeug => 760 wheezy.caching => 0 wheezy.core => 0 wheezy.html => 0 wheezy.http => 0 wheezy.routing => 0 wheezy.security => 0 wheezy.template => 0 wheezy.validation => 0 wheezy.web => 0Python has a number of web frameworks. A trivial PEP8 readability check gives you an idea where particular web framework stands in terms of internal quality. There is a wide field for improvement.