Release of JPype 0.7.2, libraries for accessing Java classes from Python

Available interlayer release JPype 0.7.2, which allows you to organize full access of Python applications to Java class libraries. With JPype from Python, you can use Java-specific libraries to create hybrid applications that combine Java and Python code. Unlike Jython, integration with Java is achieved not through the creation of a Python variant for the JVM, but through interaction at the level of both virtual machines using shared memory. The proposed approach allows not only to achieve good performance, but also provides access to all CPython and Java libraries. Project code spreads licensed under Apache 2.0.

Major changes:

  • Exceptions thrown in C++ and Java code now provide an exception stack when an exception occurs in Python code. Thus, to obtain information about the exception stack, you no longer need to call stacktrace().
  • The call return speed has been tripled.
  • Significantly (by orders of magnitude) increased transmission speed in
    numpy buffers of multidimensional arrays. Multidimensional primitives pass read-only copies created inside the JVM with a contiguous C layout.

  • All exposed internals have been replaced with CPython implementations, and the symbols __javaclass__, __javavalue__ and __javaproxy__
    deleted. A dedicated Java slot has been added to all CPython types that inherit from jpype class types. All private tables have been moved to CPython. Java types must now inherit from the JClass metaclass, which uses type slots. Mixins for Python base classes are not allowed. The types are Object, Proxy, Exception, Number and Array and inherit directly from CPython's internal implementations.

  • Improved tracing and exception handling.
  • Array slices are now processed as views that support writing back to the original, such as a numpy array. For array slicing, support is provided for setting and retrieving values ​​in steps (slice(start, stop, step)).
  • Arrays now support "__reversed__".
  • Java arrays now support the memoryview API and remove the dependency on numpy to pass the buffer contents.
  • Numpy is no longer a dependency (extra) and memory transfer to numpy is available without compiling with numpy support.
  • JInterface is designed as a meta class. Use isinstance(cls, JInterface) to check for interfaces.
  • Added missing TLDs "mil", "net" and "edu" to default imports.
  • Improved error messages for UnsupportedClassVersion during startup.
  • java.util.Map now throws a KeyError if the element is not found. Values ​​that are null still return None as expected. Use get() if you want to treat empty keys as None.
  • Removed java.util.Collection as it strangely overloads between remove(Object) and remove(int) on Lists. Use the Java remove() method to access native Java behavior, but type casting is strongly recommended for overload control.
  • java.lang.IndexOutOfBoundsException can now be caught using the IndexError exception class when accessing java.util.List elements.

Source: opennet.ru

Add a comment