Differences between revisions 1 and 17 (spanning 16 versions)
Revision 1 as of 2007-09-23 20:34:36
Size: 1410
Editor: PhilipJenvey
Comment: Pylons on jython! the current state of affairs
Revision 17 as of 2008-02-18 20:33:33
Size: 4766
Editor: PhilipJenvey
Comment: added subprocess
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
The things/steps needed to get Pylons running on Jython: #format rst
Line 3: Line 3:
* The ability to install Pylons and all its dependencies: Pylons (0.9.6.1) on Jython Requirements/TODO
============================================
Line 5: Line 6:
  - distutils and setuptools (See SetuptoolsOnJython) Installing Pylons and its dependencies
--------------------------------------
Line 7: Line 9:
Ensure all dependencies' tests pass:   * distutils and setuptools **(Mostly finished, See** `SetuptoolsOnJython`_ **)**
Line 9: Line 11:
* Paste, PasteDeploy and PasteScript   * Ensure all dependencies' tests pass
Line 11: Line 13:
* Routes nose
----
Line 13: Line 16:
  - (I actually tested routes on Jython over a year ago and all the tests passed after one small change) Pylons projects require nose, but most packages (including Pylons) use nose as their own test runners.
Line 15: Line 18:
* Beaker requires:
Line 17: Line 20:
* WebHelpers   * optparse module **(added in r4018)**
Line 19: Line 22:
* FormEncode   * a fix for the cell variable (variables used in closures) bug here: http://pylonshq.com/pasties/667 **(fixed in r4038)**
Line 21: Line 24:
* simplejson   * fix for new.instancemethod not allowing a PyType as its class argument **(fixed in r4051)**
Line 23: Line 26:
* decorator   * fix for inspect.argspec not working (also needed for Pylons, among other things) **(fixed in r4053)**
Line 25: Line 28:
  - Note: decorators aren't currently supported in Jython, however the decorator module doesn't actually use decorators (works on CPython 2.3)   * imp.find_module returned entries in regard to bytecode files instead of .py files when they were available **(fixed in r4080)**
Line 27: Line 30:
* nose
  - nose requires the optparse (easy) and the compiler module (sort of easy -- compiler requires the parser module, which isn't easy to get). nose only needs the compiler module to use compiler.consts.CO_GENERATOR, maybe jython could provide a broken compiler module that doesn't import parser.
  * fix type names and class __module__ in doctests **(fixed in r4107, 4111)**
Line 30: Line 32:
* Mako   * methods weren't always inheriting their inner functions' __name__ and __doc__ **(fixed in r4109)**
Line 32: Line 34:
Later down the road:   * compiler package (and compiler requires the parser module which Jython lacks). nose only needs the compiler module to use compiler.consts.CO_GENERATOR; until there's a parser jython will provide a broken compiler module that doesn't import parser **(added in r4114)**
Line 34: Line 36:
* SQLAlchemy. The [http://www.sqlalchemy.org/trac/ticket/672 Dialect Refactor II] ticket will need to be implemented to properly support using SQLAlchemy via Jython's DBAPI jdbc driver, [http://jython.org/Project/userguide.html#database-connectivity-in-jython zxJDBC]. Frank Wierzbicki has done some preliminary work on using SQLAlchemy with Jython, info [http://groups.google.com/group/sqlalchemy/browse_frm/thread/d60db24fe1683a41/09320033f406d78b?hl=en&lnk=gst here] Routes
------
All tests, except some which require paste.fixture (Paste is troublesome to import at this point), pass


Paste, PasteDeploy and PasteScript
----------------------------------
requires:

  * modulefinder module (imported in paste/__init__.py). Jython currently lacks it, and modulefinder relies on reading code objects via marshal.load

  * subprocess module: if it doesn't exist (Python 2.3) it uses a version copied over from CPython 2.4 (paste.util.subprocess24) **(added in r4150)**

  * webbrowser module: paste.fixture imports it. Jython doesn't include it. It's a pretty simple module -- though it doesn't seem to work right on Jython when launching a console browser (like lynx or links). I think it's an os.system problem

  * paste.script.util.uuid requires the Python 2.3 int/long unification (PEP 237) phase B

  Offending code is:

  int("00c04fd430c8", 16)
  
  Exception:

  File "/Users/pjenvey/src/java/jython-trunk/dist/Lib/site-packages/PasteScript-1.6.2dev_r7203-py2.3.egg/paste/script/util/uuid.py", line 49, in __init__

  ValueError: invalid literal for __int__: 00c04fd430c8

Mako
----
requires:

  * compiler module: to parse Python code into AST. The compiler module is mostly pure Python code, but its guts are really the native parser module (which Jython lacks)

Beaker
------
requires:

  * Paste (for paste.fixture)
  * base64.b64encode: might die on an attempting to import b64encode in beaker.crypto.PBKDF2 (at least it does when the tests are run)

WebHelpers
----------
requires:

  * routes
  * simplejson

FormEncode
----------
requires:

  * gettext (which requires the locale module, which Jython lacks) **(both were added in r4077, 4084)**

simplejson
----------

  * `SetuptoolsOnJython`_ (actually distutils) currently has trouble installing simplejson, because it attempts to compile its optional C extensions (that help performance). It expects to catch a distutils.errors.CCompilerError if the compilation fails, but Jython dies much earlier:

  File "/Users/pjenvey/src/java/jython-trunk/dist/Lib/distutils/command/build_ext.py", line 598, in get_ext_filename

  TypeError: cannot concatenate 'str' and 'NoneType' objects

decorator
---------

  * Note: decorators aren't currently supported in Jython, however the decorator module doesn't actually use decorators (works on CPython 2.3)
  * requires function.func_defaults to be writable and it currently isn't on Jython

Later down the road
===================

SQLAlchemy
----------

  * The `Dialect Refactor II <http://www.sqlalchemy.org/trac/ticket/672>`_ ticket will need to be implemented to properly support using SQLAlchemy via Jython's DBAPI jdbc driver, `zxJDBC <http://jython.org/Project/userguide.html#database-connectivity-in-jython>`_.
  
  * Frank Wierzbicki has done some preliminary work on using SQLAlchemy with Jython, info `here <http://groups.google.com/group/sqlalchemy/browse_frm/thread/d60db24fe1683a41/09320033f406d78b?hl=en&lnk=gst>`_, and is scheduled to give a talk at PyCon 2008: "Database development with Jython, SQLAlchemy, and Hibernate"

Turbogears 2
------------

  * Jim Baker has already started playing with Genshi on the `Jython modern branch <http://fisheye3.cenqua.com/browse/jython/branches/modern>`_

Pylons (0.9.6.1) on Jython Requirements/TODO

Installing Pylons and its dependencies

  • distutils and setuptools (Mostly finished, See SetuptoolsOnJython )
  • Ensure all dependencies' tests pass

nose

Pylons projects require nose, but most packages (including Pylons) use nose as their own test runners.

requires:

  • optparse module (added in r4018)
  • a fix for the cell variable (variables used in closures) bug here: http://pylonshq.com/pasties/667 (fixed in r4038)
  • fix for new.instancemethod not allowing a PyType as its class argument (fixed in r4051)
  • fix for inspect.argspec not working (also needed for Pylons, among other things) (fixed in r4053)
  • imp.find_module returned entries in regard to bytecode files instead of .py files when they were available (fixed in r4080)
  • fix type names and class __module__ in doctests (fixed in r4107, 4111)
  • methods weren't always inheriting their inner functions' __name__ and __doc__ (fixed in r4109)
  • compiler package (and compiler requires the parser module which Jython lacks). nose only needs the compiler module to use compiler.consts.CO_GENERATOR; until there's a parser jython will provide a broken compiler module that doesn't import parser (added in r4114)

Routes

All tests, except some which require paste.fixture (Paste is troublesome to import at this point), pass

Paste, PasteDeploy and PasteScript

requires:

  • modulefinder module (imported in paste/__init__.py). Jython currently lacks it, and modulefinder relies on reading code objects via marshal.load
  • subprocess module: if it doesn't exist (Python 2.3) it uses a version copied over from CPython 2.4 (paste.util.subprocess24) (added in r4150)
  • webbrowser module: paste.fixture imports it. Jython doesn't include it. It's a pretty simple module -- though it doesn't seem to work right on Jython when launching a console browser (like lynx or links). I think it's an os.system problem
  • paste.script.util.uuid requires the Python 2.3 int/long unification (PEP 237) phase B

Offending code is:

int("00c04fd430c8", 16)

Exception:

File "/Users/pjenvey/src/java/jython-trunk/dist/Lib/site-packages/PasteScript-1.6.2dev_r7203-py2.3.egg/paste/script/util/uuid.py", line 49, in __init__

ValueError: invalid literal for __int__: 00c04fd430c8

Mako

requires:

  • compiler module: to parse Python code into AST. The compiler module is mostly pure Python code, but its guts are really the native parser module (which Jython lacks)

Beaker

requires:

  • Paste (for paste.fixture)
  • base64.b64encode: might die on an attempting to import b64encode in beaker.crypto.PBKDF2 (at least it does when the tests are run)

WebHelpers

requires:

  • routes
  • simplejson

FormEncode

requires:

  • gettext (which requires the locale module, which Jython lacks) (both were added in r4077, 4084)

simplejson

  • SetuptoolsOnJython (actually distutils) currently has trouble installing simplejson, because it attempts to compile its optional C extensions (that help performance). It expects to catch a distutils.errors.CCompilerError if the compilation fails, but Jython dies much earlier:

File "/Users/pjenvey/src/java/jython-trunk/dist/Lib/distutils/command/build_ext.py", line 598, in get_ext_filename

TypeError: cannot concatenate 'str' and 'NoneType' objects

decorator

  • Note: decorators aren't currently supported in Jython, however the decorator module doesn't actually use decorators (works on CPython 2.3)
  • requires function.func_defaults to be writable and it currently isn't on Jython

Later down the road

SQLAlchemy

  • The Dialect Refactor II ticket will need to be implemented to properly support using SQLAlchemy via Jython's DBAPI jdbc driver, zxJDBC.
  • Frank Wierzbicki has done some preliminary work on using SQLAlchemy with Jython, info here, and is scheduled to give a talk at PyCon 2008: "Database development with Jython, SQLAlchemy, and Hibernate"

Turbogears 2

PylonsOnJython (last edited 2009-09-14 22:04:24 by PhilipJenvey)