Wednesday, August 22, 2012

pep 8 on pycharm

Pep 8 standard is a good convention to use when coding especially when working as a team.Standards and conventions make reading other peoples code easier.Getting yourself to start adhere to these  standards takes some time and effort, but by using the right tools it can take a shorter time.By the way, taking your time to learn these standards is quite worth the effort.

Pycharm is a wonderful python IDE which i would recommend to anybody doing development in python.Using pycharm you can set pep8 as an external tool, which you can invoke on any file you are currently working on to  check whether it violates any standards.This can be done this way.

Install pep8 package from the python package index

pip install pep8

go to: File > Settings > External Tools > Add new


if your using virtual env, use the path to pep8 installed in the virtualenv's bin directory.Otherwise point it to the location where pep8 is installed, use the whereis command to find it.
Now add an output filter as follows.

You can now access the command from the tools menu or conveniently right click anywhere within the file currently being edited and select the command.
The output should be quite helpful in identifying changes which need to be made.


No comments:

Post a Comment