Python developement IDE's

Why use an IDE?

  • Syntax highlighting
  • Code completion
  • Automatic import/class/method outlines
  • Automatic syntax checking with highlighted error lines
  • Automatic checking of 'good coding' conventions
  • Code wizards (ie: create a try/except statement with one button)
  • Refactoring (ie: rename one variable, and dependent variables are renamed too)
  • Tasks (ie: clickable list of all the comments starting with TODO or FIXME)
  • Matching bracket highlighting
  • Built-in CVS, pretty GUI for comparing different versions of the same file
  • Etc...

Summing it up, because it makes you more productive, and probably alot happier ;-)

What is the best Python IDE?

Eclipse + pyDev + pyLint

I have tried Idle (comes with Python), and PyPE (http://pype.sourceforge.net/), but they can't match the power of this combination IDE. Moreover, the Eclipse + pyDev + pyLint combination works on any platform. Eclipse is mainly a Java IDE, however it has a powerful plugin system, allowing the pyDev plugin to turn Eclipse into a Python IDE. pyLint is used as a plugin to pyDev (a plugin of a plugin), to check the 'goodness' of your code as your working on it. Did you create an unreachable statement? pyLint will warn you and highlight that line.

Picture taken using Eclipse, pyDev, and pyLint

Where can I get more information on the best Python IDE?

Eclipse --> http://www.eclipse.org/eclipse/

pyDev --> http://pydev.sourceforge.net/index.html

pyLint --> http://www.logilab.org/projects/pylint

How do I install Eclipse, pyDev, and pyLint?

NOTE: If your using it at the MSDL lab, everything is already installed, you can move along to the "Using" phase. However, you may want to download this little script to startup Eclipse first... Eclipse Start Script

Eclipse

  1. Go to the Eclipse website and download Eclipse SDK 3.1 (make sure to get the Windows or Linux GTK version depending on your platform)
  2. Extract where you want it
  3. Start it with either of (depends on your system): eclipse.exe, ./eclipse, java -jar startup.jar, or java -Dosgi.locking=none -jar startup.jar
  4. Setup your project workspace somewhere...
  5. Now you can either Import an existing Python project such as AToM3, or you can create a new project (In the Wizard choose: Simple-->Project). But you still need to configure some more stuff before you start coding...

pyDev and pyLint

  1. Get a local copy of these from HERE
  2. Extract to a temporary directory
  3. Copy the extracted eclipse folder OVER your installation of eclipse (this installs pyDev, as it will insert pyDev into the plugins directory of eclipse)
    Specifically: your goal is to get eclipse/plugins/[pydev stuff] and eclipse/features/[pydev stuff]
  4. Now open a console and change directory to the common folder. Run "python setup.py install"
  5. Do the same in the pylint folder. Run "python setup.py install". NOTE: The order of these operations could be important!
  6. Now pyLint should be in your python installation under lib/site-packages/pyLint... remember this for later...
    You can test your pyLint installation by going to the appropriate directory in your console and typing 'python lint.py lint.py' to run pyLint on itself.

    Example:
    F:\PythonIDE_PresentationMaterial\pylint-0.7.0\pylint-0.7.0>lint.py --html=y lint.py > sampleLint.html
    HTML pyLint output
    NOTE: A simple lint.bat script can come in handy, like: python E:\Python23\Lib\site-packages\pylint\lint.py --disable-msg=W0311,C0103 %1

Using Eclipse + PyDev + PyLint instructions:

  1. Window-->Open Perspective-->Other...-->Resource
    This will setup the Windows for Python developement
    You can move resulting windows around by clicking and dragging them...
  2. Window-->Preferences-->Pydev-->Python Interpreters-->New-->[Find your python.exe or python]
    This will allow pyDev to do basic syntax checking on your code as you type it.
    On Linux, typing 'locate python > temp.txt' and opening temp.txt in a textpad was helpful to me for this task, and I found it in /usr/local/bin/python
    It has been installed in the MSDL lab at: /usr/local/bin/python2.4
  3. Window-->Preferences-->Pydev-->PyLint
    Check "Use PyLint", this will enable a superb tool for making sure your code is bug free and meets high coding standards.
    Check "Refactor" and any unchecked categories of messages, they're all useful.
    Browse for the location of pyLint. It will be in your python directory in /lib/site-packages/pylint/lint.py
    It has been installed in the MSDL lab at: /usr/local/lib/python2.4/site-packages/pylint/lint.py
  4. Window-->Show view-->Problems
    You definately want this window open. This is where errors in your code will be listed, as well as whatever coding conventions you violated by pyLint.
    NOTE: you *MUST* click the 'Filter' icon in the Problems window and enable pyLint problems to display.

Okay I did all that... how do I create a project and Python file again?

File-->New-->Project-->Simple-->Project
In the Navigator window, you can create a new "File", make sure to give it a .py extension!
If you want pyLint to update, pressing ctrl-B will force a Build

Maintained by Denis Dube. Last Modified: 2008/09/10 00:03:05.