EuroSciPy logo

EuroSciPy 2013

Brussels, Belgium - August 21-24 2013

JyNI - Using native CPython-Extensions in Jython

Stefan Richthofer

Abstract

Jython is a Java-based Python implementation and the most seamless way to integrate Python and Java. However, it does not support native extensions written for CPython like NumPy and Scipy. Since most scientific Python-code fundamentally depends on exactly such native extensions directly or indirectly, it usually cannot be run with Jython. JyNI (Jython Native Interface) aims to close this gap. It is a layer that enables Jython-users to load native CPython-extensions and access them from Jython the same way as they would do in CPython. In order to leverage the JyNI functionality, you just have to put it on the Java-classpath when Jython is launched. It neither requires you to recompile the extension-code, nor to build a customized Jython-fork. That means, it is binary compatible with existing extension-builds.

At the time when this abstract is written, JyNI does not fully implement the Python C-API and we are in fact just capable to load simple examples that only involve most basic builtin-types. The concept is rather complete though and our goal is to provide the C-API needed to load NumPy as soon as possible. After that we will focus on SciPy and others.

We expect that our work will also enable Java developers to use CPython-extensions like NumPy in their Java-code.

For further information visit our project homepage at www.jyni.org.

Sponsors