Skip to content

Latest commit

 

History

History
109 lines (82 loc) · 4.71 KB

3.9-notes.rst

File metadata and controls

109 lines (82 loc) · 4.71 KB

Jep 3.9 Release Notes

This release is compatible with Python 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, and 3.8. It is compatible with Java versions >= 1.7. This will be the last release to support Python 2 and the last release to support Java 1.7. It may also be the last release to support Python 3.3, 3.4, and 3.5.

If you are using a feature that we have deprecated or removed, and the javadoc does not explain a suitable alternative, please notify us. If you are still using Jep with Python 3.3, Python 3.4, or Python 3.5, please notify us.

New interface Interpreter and new class SubInterpreter

A new interface jep.Interpreter and new class jep.SubInterpreter are provided to better distinguish a SubInterpreter from a SharedInterpreter. The use of the interface also allows a developer to more quickly switch between the concrete types for testing which interpreter to use. Where possible a developer should strive to use the interface and only specify the implementation at construction. Alongside this change, many methods on the Jep class have been deprecated in preparation for a future release.

Numpy scalar types can be converted to equivalent Java boxed primitives

The numpy types float64, float32, int64, int32, int16, and int8 can now be converted to the appropriate java.lang equivalents of Double, Float, Long, Integer, Short, and Byte, respectively.

Jep supports exec method

Jep now supports executing multiple Python statements from a single Java String using the new Jep.exec(String) method which works similar to the Python builtin exec(string).

MainInterpreter supports loading the jep native library from an absolute path

The class MainInterpreter now supports specifying an absolute path from which the jep library (libjep.so, libjep.dll, libjep.jnilib) will be loaded. Using this method will take precedence over other methods of finding the location of the library.

PyBuffers can be converted to Java arrays

Python objects that implement the Buffer Protocol can now be converted into Java arrays.

Direct memory java.nio.Buffer objects can share memory as Python Buffers

The java.nio classes ByteBuffer, CharBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, and ShortBuffer can be wrapped as PyJObjects. If they are direct (i.e. use direct memory) they can share memory with Python objects through the use of the Python Buffer Protocol.

New methods PyCallable.callAs(Class, args)

PyCallable has new methods callAs(Class, args) where the return object will match the expected type, the Class argument. Contributed by Jeremy Smith.

New method PyObject.as(Class)

A method PyObject.as(Class) has been that will use Jep's builtin conversions to return a Java representation of the PyObject.

PyObject can now implement Java interfaces

PyObject has a new method proxy(Class, Class...) that provides creation of a Proxy to a Python object that matches a Java interface. These interfaces only work correctly if the Python method names match the Java method names, but they can be used to invoke Python methods from Java. For example, a Java interface DataFrame could be used to invoke methods on a Python pandas DataFrame, if the Java interface had some or all of the methods on a pandas DataFrame.

Compatibility Notes

Default Java conversion for some numpy scalars changed on some platforms.

In previous versions of Jep numpy scalar conversion was platform dependent. On some platforms a numpy int32 and a float32 would be converted to a java.lang Long and Double, respectively. In this version the conversion is consistent across platforms, a numpy.int32 will default to a java.lang.Integer and a numpy.float32 will default to a java.lang.Float. The old conversions are still possible if they are explicitly needed. For example a Java method taking a Double can still take a numpy.float32, however a Java method taking an Object or Number will now get a Float whereas previously it might be a Double.

set methods on PyObject removed

The set(args) methods on PyObject have been removed in favor of using setAttr(String, Object).

javax.script support removed

The Jep classes implementing the javax.script classes have been removed.