A little background:
I run pep8.py manually when I'm scripting, but with bigger projects I prefer to use Eclipse. It would be really useful to integrate pep8.py in Eclipse/Pydev, so it can be run automatically in all the files in the project, and point to the lines containing the warnings. Maybe there is an obvious way to do it, but I haven't found it yet.
Question is: How to integrate pep8.py in Eclipse?
As of PyDev 2.3.0, pep8
is integrated in PyDev by default, even shipping with a default version of it.
Open Window > Preferences
It must be enabled in PyDev > Editor > Code Analysis > pep8.py
Errors/Warnings should be shown as markers (as other things in the regular code analysis).
In the event a file is not analyzed, see https://stackoverflow.com/a/31001619/832230.
I don't know how to integrate it for whole project, but I have used it as an external tool to analyze an individual file.
Note that the pycodestyle
package is the official replacement for and is the newer version of the pep8
package. To install it, run:
$ sudo pip install --upgrade pycodestyle
Next, in Eclipse:
pycodestyle
.Fill following fields:
Location -- ${system_path:pycodestyle}
Working directory -- ${container_loc}
Arguments -- "${resource_name}"
(This uses the currently active file.)
Go to Common tab and confirm that the Allocate Console checkbox is checked.
A benefit of this approach is that you can use a very up-to-date version of the package, and are not limited to the old version included with PyDev. And if you are curious about setting up pylint
in a similar manner, see this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With