Differences between revisions 88 and 89
Revision 88 as of 2006-01-17 22:14:33
Size: 10471
Editor: PPOON
Comment: new version of PyDev
Revision 89 as of 2006-01-17 22:21:42
Size: 10472
Editor: PPOON
Comment: changed RedRobin to JyDT
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
|| RedRobin || http://jydt.sf.net || 1.4.10 || July 12, 2005 || || Jython only || || || JyDT || http://jydt.sf.net || 1.4.11 || September 12, 2005 || || Jython only || ||

Using Eclipse as a Python editor

It is not known which version of Eclipse these comments refer to, some versions of the plugins require Eclipse 3 to work with. Please be careful read the release notes for the plugin you choose.

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:

Name

URL

Version

Last Update

Licensing

Supports Jython

Remarks

PyDev

http://pydev.sf.net/

0.9.8.7

January 17, 2006

EPL*

Yes

TruStudio

http://www.xored.com/products.php

1.0.x / 1.1

May 18, 2005

EPL* and commercial

JyDT

http://jydt.sf.net

1.4.11

September 12, 2005

Jython only

EclipseColorer

http://colorer.sf.net/

0.7.1

July 12, 2005

Mozilla PL / GPL

yes?

Syntax highlighting only

pyeclipse

http://sf.net/projects/pyeclipse/

0.0.1

July 16, 2002

dead?

pe4eclipse

http://sf.net/projects/pe4eclipse/

0.0.1

September 17, 2002

dead?

* Eclipse Public License

To point out the obvious, it would be nice if some of these teams would combine their efforts.

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.


  • All three plug-ins (at the time of the writing, pyeclipse, pe4eclipse, and pythoneclipse -- more on pydev below) only really give you color highlighting for editing .py python/jython files. That's all. (as of May 2003)

  • Significantly, you can use Eclipse bookmarking and create task bookmarks inside the eclipse python editor. This is way cool.

  • Lines with def are given little notches in the scroll bar, which you can click on and jump to that python function/method.

  • You can run jython or python on the current file and get the output appear in the eclipse console window.

  • Red Robin has been around since late 2003; it became open source in 2005.

Generic Useful Features:

  • You can use the Search/Grep feature of Eclipse to search through your python source code modules.
  • You 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.
  • Instead 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.

Which plug-in is better?

All three support the SHIFT-TAB de-indent keystroke.

  • pyeclipse, 0.0.1 - CAN configure editor syntax colors. Option to converts tabs to spaces.
  • pe4eclipse, 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.
  • pythoneclipse - 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).

My choice

added by EliasSoong

When I wrote this, it is the September of 2004. I found PyDev and Tru Studio have been progressed very much. Both of them could be a mature IDE for Python. Especially, I tried the open source version of Tru Studio 1.0M4, I feel it is as good as JDT. Tru Studio could do perfect analysis of the code outline and good code assist.

Re: PyDev

added by KirbyUrner urnerk@python.org

I saw a demo of this at OSCON 2004, presented by Dana Moore. Alex Totek has done the majority of the work so far, with help from Fabio Zadrozny. pydev includes a debugger. Dana previewed auto-completion but as of this writing it's not in the most recent release (0.5.3). I also saw the Python shell integrated into Eclipse. The development language for the plugin itself is Java, not Jython.

Installing the plug-ins

Unzip the plugin and drag the folder into the eclipse/plugins directory, then restart eclipse.

  • pyeclipse is identified by the folder org.python.pyeclipse_0.0.1

  • pe4eclipse is identified by the folder net.sourceforge.pe4eclipse

  • pythoneclipse 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.

Eclipse 3.0 Interim Build Problem

Moving the pyeclipse folder, org.python.pyeclipse_0.0.1, to the eclipse/plugins directory does not install it into the environment. Eclipse does not see it at all. I am attempting to install in Eclipse Version: 3.0.0, Build id: 200402122000.

I have no answer for this yet but will update this comment if I find one.

In general, unless a plugin SAYS it supports Eclipse 3, assume it doesn't, or doesn't fully. Eclipse 3 has been enough of a moving target that many plugin developers have been taking a wait-and-see approach to porting their plugins.

Configuring Eclipse for running Python and Jython

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:

  • Name: jython

  • Tool Location: E.g. C:\jython-2.1\jython.bat

  • Working Directory: -> Browse Variables -> ${container_loc}

  • Tool Arguments: -> Browse Variables -> ${resource_name}

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:

  • 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}

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:\\

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,

How to make Jython unit tests... and see them inside Junit plugin : [http://www.devx.com/Java/Article/26602/1954?pf=true here] and modification and completion [http://lauploix.blogspot.com/2005/03/test-driven-development-why-using.html here]

Running SCons from CDT Eclipse

SCons is a powerful software construction tool in python, more flexible than ant and simpler than make. It is primarily intended to manage builts for C/C++ programs. To set up SCons as the builder from CDT, add it as a custom builder:

  • Select the project and edit its properties.
  • From the Builder menu on the left, select new.
  • Enter the full path to "scons.bat" file that comes with your installation.
  • Add command line targets as necessary in the box below.
  • Make sure python is setup in the default environment.

Note: Eclipse cannot currently spawn arbitrary shell programs, so even if the .py extension is registered, calling scons.py will fail from Eclipse.

There is now an [http://nic-nac-project.de/~lothar/eclipse/update/SConsBuilderPlugin.html Scons Builder Plugin] for the Eclipse CDT.

For more information about SCons, see http://www.scons.org/

Some Eclipse features people want with Jython/Python

  • project/file management (module organization)
  • package explorer
  • file manipulation (history, compare, replace, etc)
  • collapsible code outlining
  • integrated step-through debugging
  • UML
  • refactoring tools (rename of classes and methods)
  • indentation support (tab / backtab)
  • outline with classes and methods
  • search for references (who calls method X)
  • execution of code snippets from a file being edited
  • use the Eclipse update manager for plug-in and core jython updates
  • incremental compilation of Jython
  • syntax highlighting and auto-completion
  • support for pyunit (unittest)
  • a Jython console, where one could try short snippets of code, with access to the current project classpath

Eclipse would gain

  • Python/Jython support in the editor
    • this is what the existing plug-ins address, but they are incomplete
  • better scriptable customization
    • use Jython as the "glue" language for extending Eclipse
  • runtime interactive shell for trying and testing Java classes
  • simplifies mixing Jython/Java to broaden range of problems that can be solved
  • large user base of Jython/Python programmers

Other Links

["Jython"]

["Python"]


CategoryJython

EclipsePythonIntegration (last edited 2014-04-17 06:07:25 by DaleAthanasias)

Unable to edit the page? See the FrontPage for instructions.