score:87

Accepted answer

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.

score:-1

you don't :) instead you take advantage of very good integration with pylint and configure pylint to check all things pep8 checks. see how to configure pylint to check all things pep8 checks?

score:6

that does not yet appear to be fully integrated into pydev.

as suggested in this post,

[it] would require changing the code within pydev -- a flexible option would be adding preferences to let the user choose to which patterns he wants to match for creating hyperlinks (and saying which group in the match is the line and which one is the file)...

or, you can try it hard-coded playing with: org.python.pydev.debug.ui.pythonconsolelinetracker (should be pretty easy to grasp).

a request does exist for just that, but it seems to be still open 1 year after its creation...

score:10

code analysis :

in eclipse (pydev), if you want to code analysis using pep8 style then

go to:windows -> preferences -> pydev -> editor -> code analysis -> pep8.py tab and select warning click apply and ok button.

in your python code if you validate pep8 coding style it will give you warning

auto code formatting :

in eclipse (pydev), if you want to auto format python code using pep8 style then

go to:windows -> preferences -> pydev -> editor -> code style -> code formatter -> click on check-box (use autopep8.py for console formatting?) click apply and ok button.

if you want to increase length of line(pep8 default is 79) below use autopep8.py you can set parameter type --max-line-length=150 if you set max length to 150

if press auto-format shortcut ( ctrl + shift + f ) it will automatically format your python code like pep8 style

score:12

  1. open your eclipse
  2. go to help and select install new software
  3. click the add button and a "add repository" dialog box will appear
  4. you can use any name you like for it. (i used pydev)
  5. for the location, enter "http://pydev.org/updates"
  6. click ok.
  7. you are now in the process of installation. just wait for it to finish.
  8. after the installation, close eclipse and open it again.
  9. now that pydev is installed in your eclipse, go to window->preferences
  10. choose pydev->editor->code analysis
  11. go to pep8.py tab
  12. choose the radio button for warning and click ok.

that's it. your eclipse ide is now integrated with pep8. to run pep8.py automatically, right click on your project editor. choose pydev and click "code analysis". in your problems tab in your workspace, you will see warnings that points to the line that you have made a violation in the pep8 (if you have violated).

score:26

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:

  1. select run-external tools-external tools configurations...
  2. select program root node.
  3. press new launch configuration button.
  4. enter name for your launch configuration. i use pycodestyle.
  5. 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.


Related Query

More Query from same tag