[Zope3-dev] A very interesting project (jpype)

Garrett Smith garrett at mojave-corp.com
Sat Dec 11 12:34:46 EST 2004


(Email scanners can skip background and go to JPYPE below.)

A while back Stephan wrote an excellent example of integrating Lucene, a
Java application, into Zope3. His approach was to write a full text
indexing/search server in Java using Lucene that talks to Zope via
XML-RPC. Pretty cool -- Zope gets to use a terrific full text search
engine written in Java.

The downside to this approach is that the search engine has to run in a
separate process. And running XML-RPC over localhost, well :)

So I took a look at PyLucene, which uses gcj and SWIG to integrate
Lucene Java into the Python environment. Also very cool -- now Lucene
runs in Zope's process.

But the gcj/SWIG approach is not for the faint of heart -- lots of
moving parts to get things built correctly. It'd be nice to just load a
JVM inside Python and use it via the JNI.

JPYPE

  http://jpype.sourceforge.net/

This project lets you embed Java in Python:

  >>> from jpype import startJVM, getDefaultJVMPath, java
  >>> startJVM(getDefaultJVMPath())
  >>> java.lang.System.out.println('Hello world')
  Hello world

The gist is that jpype makes it very easy to integrate Java based
functionality into Python apps -- so we have nice Lucene based
index/search utility running in Zope.

At first blush, this is a high quality piece of software that's working
remarkably well for us.

 -- Garrett



More information about the Zope3-dev mailing list