Differences between revisions 13 and 37 (spanning 24 versions)
Revision 13 as of 2007-08-17 19:41:38
Size: 7175
Editor: GregMoore
Comment: updated 'What is the current status of Jython' with rc3 info
Revision 37 as of 2018-01-01 19:27:10
Size: 5843
Editor: MalcolmSmith
Comment: Update mobile phone information
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#acl MoinPagesEditorGroup:read,write,delete,revert All:read
Line 6: Line 5:
[[TableOfContents]]

----
== What is JPython? ==

JPython is an implementation of the Python programming language which is designed to run on the Java(tm) Platform. It consists of a compiler to compile Python source code down to Java bytecodes which can run directly on a JVM, a set of support libraries which are used by the compiled Java bytecodes, and extra support to make it trivial to use Java packages from within JPython. JPython has been renamed and superseded by Jython.
<<TableOfContents>>
Line 17: Line 11:
Jython is the successor to JPython. The Jython project was created in accordance with the CNRI JPython 1.1.x license, in order to ensure the continued existence and development of this important piece of Python software. The intent is to manage this project with the same open policies that are serving CPython so well. Jython follows closely the Python language and its reference
implementation CPython, as created by Guido van Rossum.
Jython 2.7 corresponds to CPython 2.7.
Line 19: Line 15:
Mailing lists, CVS and all current information on the Jython project is available at SourceForge, at http://sourceforge.net/projects/jython Jython started as JPython, created by Jim Hugunin in 1997. JPython was
renamed to Jython by Barry Warsaw in 1999 with the 2.0 release. Since
then, Jython 2.x releases have corresponded to equivalent CPython 2.x
releases.
Line 21: Line 20:
The name had to be changed to something other than JPython, because of paragraph 4 in the JPython-1.1 license:

{{{
 4. Licensee may not use CNRI trademarks or trade name, including
    JPython [...] to endorse or promote products [...]
}}}
----
Line 31: Line 23:
Yes. Jython is an implementation of the Python language in Java. We strive to ensure that Jython remains as compatible with CPython as possible. The latest Jython release (2.1) implements the same language as CPython 2.1 and many of the CPython standard library modules. Yes. Jython is an implementation of the Python language for the Java platform. Jython 2.7 implements the same language as CPython 2.7, and nearly all of the Core Python standard library modules. (CPython is the C implementation of the Python language.) Jython 2.7 uses the same regression test suite as CPython, with some minor modifications.
Line 33: Line 25:
There are two incompatibilities with modern CPython that often trip newcomers. First, Jython 2.1 does not implement any features added to CPython in version 2.2 or later. This includes language features such as generators, and library modules such as optparse. A more modern version of Jython is under active development. There are a number of differences. First, Jython programs cannot currently use CPython extension modules written in C. These modules usually have files with the extension .so, .pyd or .dll. If you want to use such a module, you should look for an equivalent written in pure Python or Java. However, it is technically feasible to support such extensions, as demonstrated by IronPython. For the next release of Jython, we plan to support the C Python Extension API.
Line 35: Line 27:
Second, Jython programs cannot use CPython extension modules written in C. These modules usually have files with the extension .so, .pyd or .dll. If you want to use such a module, you should look for an equivalent written in pure Python or Java.

There are a number of other differences between the two implementations that are unlikely to go away. These range from the trivial - Jython's code objects don't have a co_code attribute because they don't have any Python bytecodes; to the significant - Jython uses Java's true garbage collection rather than Python's reference counting scheme.

  http://jython.sourceforge.net/docs/differences.html

Python has never really had much of a language definition beyond it's C-based implementation. The existence of Jython changed that for the first time and will hopefully lead to a much clearer sense of what Python the language is; independent of any specific implementation.

We will be preparing a version of Python's regression test that would be appropriate for new implementations of the language. This is a good first step towards defining what parts of Python are essential and which are incidental
There are a number of other differences between the two implementations that are unlikely to go away. These range from the trivial - Jython's code objects currently do not have a co_code attribute because it is not possible to directly access Java bytecode from a class, without loading the file; to the significant - Jython uses Java's true garbage collection rather than Python's reference counting scheme.
Line 47: Line 31:
== What is the current status of JPython? == == What is the current status of Jython? ==
Jython 3.x development is in progress.
Line 49: Line 34:
JPython 1.1 was released on 28-Jan-2000. Since then, there have been no further developments on JPython. Jython 2.7.0 was released on May 3, 2015. Jython 2.7.1 release candidates will be released soon (September 2015).

Jython 2.5.3 is the last stable release for 2.5.x; we plan to release 2.5.4 final shortly (September 2015).

Unsupported releases:

Jython 2.2 was released on August 22, 2007, with 2.2.1 released on October 13, 2007.

Jython 2.1 was released on December 31, 2001

Jython 2.0 was released on January 17, 2001
Line 54: Line 50:
== What is the current status of Jython? ==

The Jython project was announced on 19-oct-2000. The first alpha release occured on 26-nov-2000.

The final release of Jython-2.0 occured on 17-jan-2001. The final release of Jython-2.1 occured on 31-dec-2001.

Jython 2.2rc3 was released on July 09, 2007.

Current work include improvements to java integration and implementing the lastest features from CPython 2.2/3.

----
Line 67: Line 52:
The startup time and runtime performance for Jython are largely determined by the JVM. The startup time and runtime performance for Jython are largely determined by the JVM. Startup time can be mitigated by using a tool like Nailgun. Running an older release of Java 7 can be much slower, due to bytecode verification.
Line 69: Line 54:
Current status is that CPython 2.3 on Windows2000 is about twice as fast as Jython 2.1 on JDK1.4 on Windows2000. However, because of Java's slow startup time, Jython starts much more slowly (2.4 s) than CPython (80 ms). This means you don't want to do standard CGI in Jython, but long-running processes are fine. Jython is approximately as fast as CPython--sometimes faster, sometimes slower. Because most JVMs--certainly the fastest ones--do long running, hot code will run faster over time.
Line 71: Line 56:
The following notes are retained for historical interest. Areas that are known to be slower include the expat emulation (which is used by ElementTree), bisect, datetime, decimal, heapq, and unicodedata, since these are all currently written in Python instead of Java; in CPython, these are all written in C. Future releases of Jytho can address this situation.
Line 73: Line 58:
At IPC-6 JimH reported speeds equal to CPython 1.4 on the pystone benchmark. When Guido released CPython 1.5 he succeeded in making it about 2x faster than the 1.4 release. The current release of CPython is 1.5.2 which might be only slightly faster than 1.5. JimH re-ran his benchmark tests against CPython 1.5 and his then current release of Jython, finding that Jython was about 2.5x slower than CPython 1.5. I have recently run a few informal benchmarks and found some interesting numbers: using Sun's JDK 1.2.1 with JIT on a Solaris 2.6 Sparc Ultra 2, I found Jython 1.1beta3 to produce pystone numbers equal to (or very slightly better than) CPython 1.5.2+.

The problem, of course, is that JITs are still not reliable enough for Jython. Turning off the JIT on the above platform, can slow Jython down by a factor of 10.

The speed of Jython is tied very tightly to the speed of the underlying JVM. The benchmark results that JimH reported were all using Microsoft's JVM from Internet Explorer 4.0. The next fastest JVM that he used was almost a factor of 2 slower than this. Since the performance of JVMs changes nearly every day, at some point I'll need to collect a set of scores comparing pystone performance on a wider variety of JVM's.

Finally, pystone is not the last word in benchmarking. At the moment I'm more concerned with making Jython complete and correct than with performance. We will continually be revisiting performance issues both to examine better benchmark's for comparing Jython and CPython (as well as other scripting languages for the JVM) and work at optimizing Jython's performance.
If you find a specific area where Jython performance is worse than CPython, and especially if you have a patch, please file a bug at http://bugs.jython.org.
Line 83: Line 62:
You might want to start with the the Apress book documenting Jython 2.5, [[http://apress.com/book/view/9781430225270|The Definitive Guide to Jython]], which is also available online as the [[http://jythonbook.com|Jython Book]], an open source version.
Line 84: Line 64:
Since Jython and Python are so closely related any good python book or documentation works well.
there are
many excellent choices available and can be found easily by using you favorite search engine and searching for Jython. Here are a few of the frequently used references:
Since Jython and Python are so closely related any good python book or documentation works well. There are also many good choices available and can be found easily by using your favorite search engine and searching for Jython. Here are a few of the frequently used references:
Line 87: Line 66:
These are a good starting points for learning python but by no means a complete list
 * The Offical source for Python Documentation - http
://python.org/doc/
 * Dive into Python is a great learning resource - http://diveintopython.org
These are good starting points for learning python but by no means a complete list:
Line 91: Line 68:
for Jython specific starting points try these
 * The Jython Users Guide - http://www.jython.org/Project/userguide.html
 * An excellent book Jython Essentials by Samuele Pedroni & Noel Rappin - http://www.oreilly.com/catalog/jythoness/
 * as the song goes, "...getting to know you.." - http://www.ibm.com/developerworks/java/library/j-alj07064/
 * An excellent Online course by Dave Kuhlman - http://www.rexx.com/~dkuhlman/jython_course_01.html
be sure to check out the references at the bottom of the last one.
 * The [[http://python.org/doc/|official Python documentation]] - (note this covers the 2.6 version of the language and libraries). This is currently being patched against the small changes seen in Jython. Note that class decorators, the ast module, and the namedtuple factory function from 2.6 were implemented in Jython 2.5.0.
Line 98: Line 70:
These are just a sampling of whats available. As I mentioned there is a lot out there and it cover a wide variety of topics. This will get you started and on you way to becoming a jython developer.  * [[http://diveintopython.net|Dive into Python]] is a great learning resource

for Jython specific starting points try these:
 * [[UserGuide|The Jython Users Guide]]
 * An excellent book, [[http://www.oreilly.com/catalog/jythoness/|"Jython Essentials"]], by Samuele Pedroni & Noel Rappin
 * as the song goes, [[http://www.ibm.com/developerworks/java/library/j-alj07064/|"...getting to know you.."]]
 * An excellent [[http://www.rexx.com/~dkuhlman/jython_course_03.html|online course]] by Dave Kuhlman

Be sure to check out the references at the bottom of the online course.

These are just a sampling of what's available. There is a lot out there and it covers a wide variety of topics. This will get you started and on you way to becoming a Jython developer and when you are ready for more, it's just a few clicks away.
Line 101: Line 83:
== Can I use Jython to make apps for mobile phones? ==
Unfortunately not. The Android operating system does use Java as its primary programming language, but there is no known port of Jython to the platform. If you want to make apps for Android smartphones, see the Python Wiki's [[https://wiki.python.org/moin/Android|Android page]] for alternative approaches.

Some older mobile phones have [[http://en.wikipedia.org/wiki/Java_Platform,_Micro_Edition|Java ME (Micro Edition)]], but Jython requires [[http://en.wikipedia.org/wiki/Java_Platform,_Standard_Edition|Java SE (Standard Edition)]], so it cannot be used on them either.

However, Jython is Free and Open Source, so if you have the skills then feel free to start porting it to any platform that interests you.

----

General Information

JythonFaq


What is Jython?

Jython follows closely the Python language and its reference implementation CPython, as created by Guido van Rossum. Jython 2.7 corresponds to CPython 2.7.

Jython started as JPython, created by Jim Hugunin in 1997. JPython was renamed to Jython by Barry Warsaw in 1999 with the 2.0 release. Since then, Jython 2.x releases have corresponded to equivalent CPython 2.x releases.

Is Jython the same language as Python?

Yes. Jython is an implementation of the Python language for the Java platform. Jython 2.7 implements the same language as CPython 2.7, and nearly all of the Core Python standard library modules. (CPython is the C implementation of the Python language.) Jython 2.7 uses the same regression test suite as CPython, with some minor modifications.

There are a number of differences. First, Jython programs cannot currently use CPython extension modules written in C. These modules usually have files with the extension .so, .pyd or .dll. If you want to use such a module, you should look for an equivalent written in pure Python or Java. However, it is technically feasible to support such extensions, as demonstrated by IronPython. For the next release of Jython, we plan to support the C Python Extension API.

There are a number of other differences between the two implementations that are unlikely to go away. These range from the trivial - Jython's code objects currently do not have a co_code attribute because it is not possible to directly access Java bytecode from a class, without loading the file; to the significant - Jython uses Java's true garbage collection rather than Python's reference counting scheme.


What is the current status of Jython?

Jython 3.x development is in progress.

Jython 2.7.0 was released on May 3, 2015. Jython 2.7.1 release candidates will be released soon (September 2015).

Jython 2.5.3 is the last stable release for 2.5.x; we plan to release 2.5.4 final shortly (September 2015).

Unsupported releases:

Jython 2.2 was released on August 22, 2007, with 2.2.1 released on October 13, 2007.

Jython 2.1 was released on December 31, 2001

Jython 2.0 was released on January 17, 2001


How fast is Jython?

The startup time and runtime performance for Jython are largely determined by the JVM. Startup time can be mitigated by using a tool like Nailgun. Running an older release of Java 7 can be much slower, due to bytecode verification.

Jython is approximately as fast as CPython--sometimes faster, sometimes slower. Because most JVMs--certainly the fastest ones--do long running, hot code will run faster over time.

Areas that are known to be slower include the expat emulation (which is used by ElementTree), bisect, datetime, decimal, heapq, and unicodedata, since these are all currently written in Python instead of Java; in CPython, these are all written in C. Future releases of Jytho can address this situation.

If you find a specific area where Jython performance is worse than CPython, and especially if you have a patch, please file a bug at http://bugs.jython.org.


How do I learn more about Jython?

You might want to start with the the Apress book documenting Jython 2.5, The Definitive Guide to Jython, which is also available online as the Jython Book, an open source version.

Since Jython and Python are so closely related any good python book or documentation works well. There are also many good choices available and can be found easily by using your favorite search engine and searching for Jython. Here are a few of the frequently used references:

These are good starting points for learning python but by no means a complete list:

  • The official Python documentation - (note this covers the 2.6 version of the language and libraries). This is currently being patched against the small changes seen in Jython. Note that class decorators, the ast module, and the namedtuple factory function from 2.6 were implemented in Jython 2.5.0.

  • Dive into Python is a great learning resource

for Jython specific starting points try these:

Be sure to check out the references at the bottom of the online course.

These are just a sampling of what's available. There is a lot out there and it covers a wide variety of topics. This will get you started and on you way to becoming a Jython developer and when you are ready for more, it's just a few clicks away.


Can I use Jython to make apps for mobile phones?

Unfortunately not. The Android operating system does use Java as its primary programming language, but there is no known port of Jython to the platform. If you want to make apps for Android smartphones, see the Python Wiki's Android page for alternative approaches.

Some older mobile phones have Java ME (Micro Edition), but Jython requires Java SE (Standard Edition), so it cannot be used on them either.

However, Jython is Free and Open Source, so if you have the skills then feel free to start porting it to any platform that interests you.


JythonFaq/GeneralInfo (last edited 2018-01-01 19:27:10 by MalcolmSmith)