I will try to answer A question.
Ad. A. It depends. If module is a Python code then it can be used as normal module. I have used this way some modules, for example python-gnupg. If module uses some C libraries like libraries to access PostgreSQL database then they could not be used by Jython (they are even impossible to install from source on environments with just Python without C compiler and PostgreSQL libs and headers). But for PostgreSQL I can use JDBC driver so it is no problem for me.
So you must check if modules you want to use are plain Python or not. It is easy while most modules have setup.py
. You can download such module, extract it in some directory and use jython setup.py install
just like:
C:\python_libs\fpconst-0.7.2>jython setup.py install
running install
running build
running build_py
running install_lib
copying build\lib\fpconst.py -> C:\jython2.5.3\Lib\site-packages
byte-compiling C:\jython2.5.3\Lib\site-packages\fpconst.py to fpconst$py.class
running install_egg_info
Writing C:\jython2.5.3\Lib\site-packages\fpconst-0.7.2-py2.5.egg-info
C:\python_libs\fpconst-0.7.2>jython
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_09
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpconst
>>> fpconst
<module 'fpconst' from 'fpconst$py.class'>
For modules that are not supported some error will be displayed:
C:\python_libs\pyodbc-2.0.58>jython setup.py install
running install
running build
running build_ext
building 'pyodbc' extension
error: Compiling extensions is not supported on Jython