Differences between revisions 38 and 39
Revision 38 as of 2004-03-07 20:20:13
Size: 8833
Editor: pool-68-237-4-198
Comment:
Revision 39 as of 2004-03-13 05:35:32
Size: 9206
Editor: h-67-101-89-223
Comment:
Deletions are marked like this. Additions are marked like this.
Line 63: Line 63:

== 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.

Using Eclipse as a Python editor

It is not known which version of Eclipse these comments refer to.

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:

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) 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 looks useful but doesn't come with source.

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).

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.

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,

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)

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.

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)

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
  • Jython unit tests of Java classes instead of JUnit?
  • 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.