Differences between revisions 46 and 47
Revision 46 as of 2008-01-29 23:01:33
Size: 10370
Editor: bkp
Comment:
Revision 47 as of 2008-01-29 23:33:09
Size: 10331
Editor: bkp
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
 * Use the Jython trunk. The Modern branch was recently merged in, and has now been deleted. So more history. Modern consolidated the bugs, workarounds, and patches found below -- plus a bunch more -- in a stable, almost-ready-to-be-merged-into-trunk version of Jython. The most important aspect is that we have tried to make Jython conform more to CPython, using Django as our guide, although there are some gaps - especially if Django already had incorporated fixes. Our driving goal is to converge on these gaps over time. Please note that is intended to be stable, performant code.  * Use the Jython trunk.
Line 51: Line 51:
With the Modern branch was recently merged in (and deleted), we have consolidated the bugs, workarounds, and patches found below -- plus a bunch more. The most important aspect is that we have tried to make Jython conform more to CPython, using Django as our guide, although there are some gaps - especially if Django already had incorporated fixes. Our driving goal is to converge on these gaps over time. Please note that is intended to be stable, performant code, and so far that looks to be the case!
Line 55: Line 57:
 * Tristan King provided a near complete subset of the functionality for {{{time.strptime}}}, as implemented in {{{org.python.modules.time.Time}}}. This needs to be enhanced. All unit tests in the CPythonLib version of test_time now pass except for {{{strptime}}} -- specifically the conversion specifier {{{'%c'}}} -- so we can also move to that, and discard our Jython version, when this is completed. That should be soon! Done.  * Tristan King provided a near complete subset of the functionality for {{{time.strptime}}}, as implemented in {{{org.python.modules.time.Time}}}. This needs to be enhanced. All unit tests in the CPythonLib version of test_time now pass except for {{{strptime}}} -- specifically the conversion specifier {{{'%c'}}} -- so we can also move to that, and discard our Jython version, when this is completed. That should be soon! Done, and in trunk.

[http://pipes.yahoo.com/pipes/pipe.info?_id=jroxOD1f3BGgvtiIqGIyXQ RSS Aggregator for blog posts about Django on Jython]

Summary of Django on Jython: The Gaps

The most important thing to know about Django on Jython is that we are almost there, and with clean code. End-to-end functionality is demonstrated by the admin tool running in full CRUD, along with a substantial number of unit tests. But this has been achieved by so far requiring only 6 lines of code in changes to Django trunk. (There will be more, however, see below.)

Running on Jython

To run Django on Jython, with a PostgreSQL backend, the following steps are necessary:

Status

Here's what works:

syncdb and the very cool Django admin run; many unit tests pass. You can run with internationalization enabled. You do need to run the dev server with --noreload for now. We need to document here how to run with [http://www.xhaus.com/modjy/ modjy], which is Alan Kennedy's servlet container for WSGI apps.

In running the model unit tests, here are the things we seem to be missing, accounting for most of the approximately 75 failures:

  • Many doctests are fragile, because they depend on the dict traversal ordering; in Jython, this is different that CPython, and if we adopt ConcurrentHashMap, it's not even repeatable. This would seem to be a pervasive bug in Django.

  • We still have some encoding problems, again seen in doctests. An example where output is expected to be lower case hex, not upper case. I fixed the problem in PyUnicode, but there are more places. Our current plan is to make test_unicode.py pass (accounting for any UTF-16 vs UCS-2/UCS-4 issues).

  • Problem with the ManagerDescriptor handling, in django.db.models.manager.

  • No decorators yet! (But they are coming soon, and are now available experimentally for Jython.)

There may be some other rough categories, we need to look at the failures more systematically. All that doctest noise is certainly annoying!

Next Steps

On the Django front, get more of the unit tests running!

Modern is now in trunk.


Historical Notes

(Preserved to show how much we had to go through...)

Merging Modern into trunk

With the Modern branch was recently merged in (and deleted), we have consolidated the bugs, workarounds, and patches found below -- plus a bunch more. The most important aspect is that we have tried to make Jython conform more to CPython, using Django as our guide, although there are some gaps - especially if Django already had incorporated fixes. Our driving goal is to converge on these gaps over time. Please note that is intended to be stable, performant code, and so far that looks to be the case!

Here are some of the things we addressed:

  • The test_extcall unit test still fails. This appears to be a dependency on dict traversal being a specific arbitrary order different from CPython's. Google's GHOP produced an improved version for Python 2.6, so we will look at this as a starting point for further analysis.

  • Tristan King provided a near complete subset of the functionality for time.strptime, as implemented in org.python.modules.time.Time. This needs to be enhanced. All unit tests in the CPythonLib version of test_time now pass except for strptime -- specifically the conversion specifier '%c' -- so we can also move to that, and discard our Jython version, when this is completed. That should be soon! Done, and in trunk.

  • Decide whether we should use ConcurentHashMap or not as the backing hash map for dict and __dict__. CHM introduces creation overhead, but it should prove to be far more scalable on multicore systems. The programming model is also far nicer with respect to Jython. Done.

Former Major Problems

Former Minor annoyances

Already Fixed

(And many more!)

DjangoOnJython (last edited 2014-05-22 23:24:19 by AdamBurke)