Pep8 and Pylint in Geany

Pep8 and Pylint are utilities that let you write cleaner Python code as per the conventions. These can be used from command line, however, I have been trying to enable it in my IDE, Geany, so that using it becomes a part of my workflow.

 

Here is how I did integrate it:

1. Install Pep8 and Pylint if not installed

easy_install pep8

easy_install pylint

 

or

pip install pep8

pip install pylint

 

2. Enable Pep8 and Pylint as build commands in Geany

Go to the Menu Build > Set build commands 

Make the below changes in the independent commands section:

- For Pep8

  In the first column, enter Pep8

  Now in the second column enter the following:

  pep8 --repeat --count "%f"

 

- For Pylint

    In the first column, enter Pylint

 

    Now in the second column enter the following:

    PYTHONPATH=${PYTHONPATH}:$(dirname %d) pylint --output-format=parseable --reports=n "%f"

 

Now, In the below row of regular expression enter the following:

  ^(.+?):([0-9]+):.+

Now Click on OK

 

Here on you will see the the above two command in the build menu. You can execute them on every file from within geany and see the errors in the IDE itself.

 

Known Issues:

Currently, If you use a virtualenv for a project those imports are falsely shown as errors. If somebody finds a way to fix these let me know.