While programming in Python I use most of the time the Python perspective provided by the PyDev plug in for Eclipse. PyDev is the abbreviation of Python Development Environment and available from http://pydev.sourceforge.net/index.html. This post outlines the steps installing PyDev and the Python lint pylint.
A convenient way to install PyDev is using this update site from the Eclipse update manager: http://pydev.sourceforge.net/updates/
After selecting the PyDev perspective inside Eclipse the first step would be to set the path to the python executable in Window->Preferences->PyDev. For downloading and installing Python more information is available from http://python.org.
To ensure a better quality of the python programs it is advisable to add pylint from http://www.logilab.org/857. These are the required step for installation:
First install EasyInstall from http://peak.telecommunity.com/DevCenter/EasyInstall by downloading and executing ez_setup.py , e.g. in a cmd.exe window:
> python ez_setup.py Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py2.5.egg Processing setuptools-0.6c8-py2.5.egg Copying setuptools-0.6c8-py2.5.egg to c:\programme\python\2.5\lib\site-packages Adding setuptools 0.6c8 to easy-install.pth file Installing easy_install-script.py script to C:\Programme\python\2.5\Scripts Installing easy_install.exe script to C:\Programme\python\2.5\Scripts Installing easy_install-2.5-script.py script to C:\Programme\python\2.5\Scripts Installing easy_install-2.5.exe script to C:\Programme\python\2.5\Scripts Installed c:\programme\python\2.5\lib\site-packages\setuptools-0.6c8-py2.5.egg Processing dependencies for setuptools==0.6c8 Finished processing dependencies for setuptools==0.6c8
Do not miss to add a path to the Scripts subdirectory of python where the easy_install.exe is located.
Then install pylint as it is mentioned on http://www.logilab.org/card/pylint_easyinstall:
> easy_install http://release.ingeniweb.com/third-party-dist/logilab.installer-0.1.tgz Downloading http://release.ingeniweb.com/third-party-dist/logilab.installer-0.1.tgz Processing logilab.installer-0.1.tgz Running logilab.installer\setup.py -q bdist_egg --dist-dir c:\temp\easy_install-mzyl5s\logilab.installer\ egg-dist-tmp-nbegf0 Adding logilab.installer 0.1dev to easy-install.pth file Installed c:\programme\python\2.5\lib\site-packages\logilab.installer-0.1dev-py2.5.egg Processing dependencies for logilab.installer==0.1dev Searching for pylint==0.14 Reading http://pypi.python.org/simple/pylint/ Reading http://www.logilab.org/project/name/pylint Reading http://www.logilab.org/projects/pylint Best match: pylint 0.14.0 Downloading ftp://ftp.logilab.fr/pub/pylint/pylint-0.14.0.tar.gz Processing pylint-0.14.0.tar.gz Running pylint-0.14.0\setup.py -q bdist_egg --dist-dir c:\temp\easy_install-ztwn3u\pylint-0.14.0\egg-dist -tmp-vng8y2 .....
The last step is to add pylint.bat to the Pydev preference, e.g. as C:\Programme\python\2.5\Scripts\pylint.bat in my setup. Invoking pylint.bat from within Eclipse leads to a “SyntaxError: invalid syntax” message in the first line. Remove the first line with the @echo off and everything works like a charm.
Tags: Eclipse, lint, perspective, PyDev, pylint