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:
pyeclipse, 0.0.1 (July 16, 2002): http://sourceforge.net/projects/pyeclipse/
pe4eclipse, 0.0.1 prealpha (September 17, 2002): http://sourceforge.net/projects/pe4eclipse/
pythoneclipse, no files (as of May 17, 2003): http://sourceforge.net/projects/pythoneclipse/
Embedding Jython into Eclipse
Don Coleman has written a jython code completion shell which he says he would be happy to rewrite for Eclipse.
This URL was given by Don Coleman in an ASPN jython users newsgroup,
but the domain "don.freeshell.org" is non-existent (DNS Error). Any other ideas where to find this code completion shell?
-- it works now (16. May 03)
What these plug-ins actually do
- Both plug-ins (pyeclipse and pe4eclipse) only really give you color highlighting for editing .py python/jython files. That's all. "(as of May 2003)"
You can use Eclipse bookmarking and creating Tasks inside the python editors. This is "way cool". Not even IDLE has bookmarking (though pythonwin does).
- 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.
Which plug-in is better?
Although the color highlighting of pe4eclipse is slightly nicer (or closer to what I am used to in pythonwin), I prefer the pyeclipse http://sourceforge.net/projects/pyeclipse/ plug-in since it supports the SHIFT-TAB de-indent keystroke. Vital!
The latter plug-in (pyeclipse) also provides a 'python' perspective (although you can easily create these yourself - a perspective is just a configuration of which panels and windows you want open) which shows the console window and hides the 'launch' button (which is only for running java apps). (Note: To launch python or jython you must configure an external tool using the steps below.)
Installing the plug-ins
Unzip the plugin download and drag it into the eclipse/plugins directory, then restart eclipse.
pyeclipse is identified by the directory org.python.pyeclipse_0.0.1
pe4eclipse is identified by the directory net.sourceforge.pe4eclipse
You can switch between the plug-ins by moving one directory "out" of the plugins folder and the other "in" to the plugins folder.
Configuring Eclipse for running Python and Jython
Configuring to run regular python from within Eclipse
Instructions for this 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:
#1 Select from the menu: Run -> External Tools -> Configure -> New Fill in the following values:
- Name: python Tool Location: E.g. /usr/bin/python or C:\Python22\python.exe
Working Directory: -> Browse Variables -> ${container_loc} Tool Arguments: -> Browse Variables -> ${resource_name}
- Name: python Tool Location: E.g. /usr/bin/python or C:\Python22\python.exe
Configuring to run jython from within Eclipse
#1 Select from the menu: Run -> External Tools -> Configure -> New Fill in the following values:
- Name: jython Tool Location: E.g. C:\jython-2.1\jython.bat
Working Directory: -> Browse Variables -> ${container_loc} Tool Arguments: -> Browse Variables -> ${resource_name}
- Name: jython Tool Location: E.g. C:\jython-2.1\jython.bat
Supplying paramters 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 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:\\
Hope this helps -Andy Bulka http://www.atug.com/andypatterns
Other Links
["Jython"]
["Python"]
