PyCharm and external lint tools
PyCharm already has a number of features present in various tools to lint/check your source code with, but offers a way to hook up external tools. Under
File > Settings is a section called
IDE Settings. One of the headings here is called
External Tools. Select this heading and then press the
Add... button on the right hand pane to configure a new external tool.
Edit Tool window that now appeared fill in a name, e.g.
PEP8 and a group name
Lint and add a description. Next point the
Program to the location of the
pep8.exe executable, e.g.
Parameters you need to use
Working directory should be filled in by default. Once done, you can close it by pressing the
Now, pyflakes has no .exe or .bat file to accompany it. You will need to add a pyflakes.bat in your
Scripts directory inside Python with the following contents:
@echo off rem Use python to execute the python script having the same name as this batch rem file, but without any extension, located in the same directory as this rem batch file python "%~dpn0" %*
Within PyCharm you follow largely the same settings as for pep8, however make sure to point to the batch file of pyflakes under
Program. Close the external tools configuration windows by clicking
OK twice. Under the menu heading
Tools you should see an submenu heading
Lint which, in turn, should contain two menu items: PEP8 and Pyflakes.
Now open a Python file, go to
Tools > Lint > PEP8 and you should get output like the following in your Run (4) window:
D:\Python26\Scripts\pep8.exe D:\pprojects\babel\babel\tests\__init__.py D:\pprojects\babel\babel\tests\__init__.py:16:1: E302 expected 2 blank lines, found 1 Process finished with exit code 1