Eclipse Integration
Home Up

 

For a wikki dedicated to this topic, see http://www.python.org/cgi-bin/moinmoin/EclipsePythonIntegration 

1 Using Eclipse as a Python editor

A few plugins for Eclipse are in progress that will enable Eclipse to be used as a Python IDE. Some of these are stable enough for early use:

bullet Red Robin - Jython development plug-in for Eclipse - (GOOD) http://home.tiscali.be/redrobin/jython/index.html
bulletpydev, (0.5.3 July 25, 2004): http://sourceforge.net/projects/pydev/ (THE BEST)
bullet pyeclipse, 0.0.1 (July 16, 2002): http://sourceforge.net/projects/pyeclipse/
bullet Tru Studio <Python>, 0.4.0 Early Access (June 29, 2003): http://www.xored.com/products.php
bullet Colorer, Colorer-take5 beta2: http://colorer.sf.net (syntax highlighting only)

Inactive/dead (apparently) plugin projects:

bulletpe4eclipse, 0.0.1 prealpha (September 17, 2002): http://sourceforge.net/projects/pe4eclipse/
bulletpythoneclipse, (as of May 17, 2003): http://sourceforge.net/projects/pythoneclipse/ (whilst there are no files on sourceforge, you can download the release from http://www.kalab.com/freeware/pythoneclipse/pythoneclipse.htm). As of Jan 21, 2004, this site states "This project has been discontinued".
bulletejython started in October but doesn't seem to be progressing beyond the initial drop . http://ejython.tigris.org/ (5/2004 project nonexistent -- I wonder what became of the code?)

1.1 What these plug-ins actually do

The next seven sections of documentation, up to and including "Supplying parameters to your jython or python program" are contributed by Andy Bulka abulka@netspace.net.au

 

 

bulletAll three plug-ins only really give you color highlighting for editing .py python/jython files. That's all. (as of May 2003)
bulletSignificantly, you can use Eclipse bookmarking and create task bookmarks inside the eclipse python editor. This is way cool.
bulletLines with def are given little notches in the scroll bar, which you can click on and jump to that python function/method.
bulletYou can run jython or python on the current file and get the output appear in the eclipse console window.

Generic Useful Features:
bulletYou can use the Search/Grep feature of Eclipse to search through your python source code modules.
bulletYou can define a "working set" which is a custom list of python files that you want to have listed in the left hand Navigator window.
bulletInstead of importing a folder into eclipse (which copies the files into c:\eclipse\workspace\...) you can instead create a linked folder which means that you can edit files on your regular file system. To do this, create a new folder, then when prompted, click "Advanced" and select the folder on your file system to link to. Sometimes you have to 'refresh' the list by r.clicking on the folder and selecting 'refresh'.

Note: The ability to run jython or python on the current file needs to be configured manually (see step 2, below) and doesn't require either of these plugins to do.

1.2 Which plug-in is better?

All three support the SHIFT-TAB de-indent keystroke.
bulletpyeclipse, 0.0.1 - CAN configure editor syntax colors. Option to converts tabs to spaces.
bulletpe4eclipse, 0.0.1 - NO configuration of colors. NO option to converts tabs to spaces. CAN override default text font and set this specifically. CAN turn line numbering on.
bulletpythoneclipse - NO configuration of colors. Option to converts tabs to spaces.

The pyeclipse plug-in provides a python' perspective which ensures that the console window is visible and hides the 'launch' button (which is only for running java apps).

Note: once you have this perspective installed, you can switch to one of the other python plugins (see how to do this in the next section), and the "perspective view" will remain installed. In fact you can easily create a python perspective yourself, from within Eclipse (a perspective is just a configuration of what panels and windows you want open at the one time).

1.3 Installing the plug-ins

Unzip the plugin and drag the folder into the eclipse/plugins directory, then restart eclipse.
bulletpyeclipse is identified by the folder org.python.pyeclipse_0.0.1
bulletpe4eclipse is identified by the folder net.sourceforge.pe4eclipse
bulletpythoneclipse is identified by the folder org.pythoneclipse.pdt_0.0.3

You can switch between the plug-ins by moving one directory out of the plugins folder and the other in to the plugins folder.

2 Configuring Eclipse for running Python and Jython

2.1 Jython

To configure Eclipse to run jython on the current file you are editing:

Select from the menu: Run -> External Tools -> Configure -> New

then fill in the following values:
bulletName: jython
bulletTool Location: E.g. C:\jython-2.1\jython.bat
bulletWorking Directory: -> Browse Variables -> ${container_loc}
bulletTool Arguments: -> Browse Variables -> ${resource_name}

2.2 Python

Instructions for configuring to run regular python from within Eclipse can be found in the pyeclipse forum http://sourceforge.net/forum/forum.php?thread_id=717580&forum_id=194323

However, I prefer to set my Working Directory to ${container_loc} since this lets you launch python on files that are inside folders within your project. More resilient. Here are my instructions:

Select from the menu: Run -> External Tools -> Configure -> New

then fill in the following values:
bulletName: python
bulletTool Location: E.g. /usr/bin/python or C:\Python22\python.exe
bulletWorking Directory: -> Browse Variables -> ${container_loc}
bulletTool Arguments: -> Browse Variables -> ${resource_name}

2.2.0.1 Supplying parameters to your jython or python program

If you need to run an app which requires arguments, you will need to make another tool configuration (just copy the jython one) and simply add the necessary arguments to the Tool Arguments field.

For example instead of just

${resource_name}

you would instead put

${resource_name} c:\\

Notice I have supplied the argument c:\\

 

 

For a wikki dedicated to this topic, see http://www.python.org/cgi-bin/moinmoin/EclipsePythonIntegration

Jython

Python