State of Python on the JVM
Jython is an implementation of the Python programming language designed to run on the JVM. It has been around for a little more than 10 years but it was in a fairly stagnant state for much of that time. More recently there has been a lot more going on in the Jython camp which is helping Python increase it's footprint on the JVM. InfoQ recently had the opportunity to interview the Jython project lead, Frank Wierzbicki, about Jython and the state of Python on the JVM.
Over the past year or so it really seems like there is more buzz surrounding Jython, why do you think that is?
I think the 2.5 release of Jython, which is more compatible with CPython than any previous release of Jython, has been a big part of that. We are able to run a much larger percentage of Python apps and frameworks than ever before. Django, Pylons, Py2Web are working well, SQLAlchemy 0.6 will work with Jython, and work is progressing on Twisted, TurboGears, and Grok (to name a few). All of this while being able to access Java libraries as if they where native to Python.
What's Sun Microsystems role in the development of Jython?
Sun allows me to work on Jython full-time. I have also been helping the NetBeans folks make Python and Jython a first class part of the NetBeans IDE, and getting Jython, Django, and Pylons working with GlassFish. And of course those teams are helping with Jython by incorporating it into their work.
What are the most important changes for Jython 2.5?
The focus of 2.5 was to make Jython a great, modern, CPython compatible implementation of Python. We really tried to make as many pure Python frameworks and applications work as we possibly could. We didn't put too much time into performance tuning, but we're looking at that next. That said, we perform reasonably well compared to CPython.
What's on the road map for Jython 2.6?
We are now looking hard at performance, but we are also adding plenty of features. For example, we are planning to improve our integration with Java libraries. In particular, we need to replace a tool from Jython 2.2.x and back called "jythonc" that made it more convenient to implement certain kinds of Java integration and package the results up in jars (One of Java's distribution formats). We were unable to support some of the new Python features with jythonc because of its internal design. We will also be making sure that even more applications and frameworks will work on Jython. We're looking forward to the day when having an app that doesn't run on Jython will be considered a bug in the app :)
Is there going to be a Jython3k?
Most definitely! 3.0 is the future of Python, and so it is the future of Jython. We have not started working on Jython3k in earnest, but I expect that we will get very serious about it once we release 2.6. The reason we are waiting for 2.6 is that the tools for migrating from Python 2 to Python 3 require 2.6 as a staring point.
Are you seeing Jython being adopted for more enterprise applications?
I have been hearing about people putting WAR files containing Pylons or Django on Jython into production, and I've heard of a few shops that find Jython's integration with JDBC is working better for them than CPython's database access in certain circumstances. The fact that 2.5 is a modern Python is making it a good choice in many situations.
I'm not sure people generally realize how old Jython is -- it's first release happened in July of 1998. At the time it was the most full featured programming language on the JVM outside of Java. So enterprises have actually been using it for a long time. For example, Jython is the admin scripting language for both IBM WebSphere and Oracle WebLogic.
What's your view on the state of python on the JVM?
Things are going very well for Python on the JVM. The Da Vinci Machine project led by John Rose has been working hard to make the JVM a better place for dynamic languages. This work is making its way into JDK 7 and will go a long way towards helping Jython perform screamingly fast once we are able to take advantage of this work. I am prototyping a Jython to take advantage of this work now.
Besides a lot of the work happening on the Jython programming language there have been other resources popping up surrounding the language including a new book about the language, a book about administering WebSphere with Jython, an online book, a podcast and talks and tutorials at PyCon. To get started check out some of the links above or head over the Jython Home Page for everything you'll need to explore Python on the JVM.
- Jython 2.5.1 Release
- Python Developer Center at Sun Microsystems
- Support for Dynamically Types Languages in the Java Virtual Machine (Article)
- Jython Blog Posts
I employ Grinder usually for a quick load-testing framework when thrown on a project. Grinder V3 uses Jython as its glue. I found the documentation a little confusing at first. But I think that was because I started with file IO (which is python-like) and thought there would be more parallels. I realized it was Java and started having an easier go of it.
VM Language Tooling
We actually employ Jython in the creation of Pushtotest's TestMaker, since Python was a nice language to create test script.
Actually, TM supports all languages in JSR223 to create test scripts, but the problem is the actual migration of Libraries.
For instance, in trying to run a Mozmill script (with runners in Python) we faced that Jython had no direct support for some dlls in the windows space.
And for Ruby, some gems were not supported. So, it is a very good implementation, but may not work if your solution is "too native".
Ruslan Meshenberg Sep 21, 2014