- Notifications
You must be signed in to change notification settings - Fork18
License
jpy-consortium/jpy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
jpy is abi-directional Python-Java bridge which you can use to embed Javacode in Python programs or the other way round. It has been designedparticularly with regard to maximum data transfer speed between the twolanguages. It comes with a number of outstanding features:
- Fully translates Java class hierarchies to Python
- Transparently handles Java method overloading
- Support of Java multi-threading
- Fast and memory-efficient support of primitive Java array parameters viaPython buffers(e.g.Numpy arrays)
- Support of Java methods that modify primitive Java array parameters (mutableparameters)
- Java arrays translate into Python sequence objects
- Java API for accessing Python objects (
jpy.jar
)
jpy has been tested with Python 3.6–3.13 and OpenJDK 8+ on Linux, Windows, and macOS.
The initial development of jpy was driven by the need to write Pythonextensions to an established scientific imaging application programmed inJava, namely theSNAP toolbox, the SeNtinelApplication Platform project, funded by theEuropean SpaceAgency (ESA). (jpy is bundled with the SNAPdistribution.) Current development and maintenance is funded byDeephaven.
Writing such Python plug-ins for a Java application usually requires abi-directional communication between Python and Java since the Pythonextension code must be able to call back into the Java APIs.
For more information please have a look into jpy's
Install a JDK 8, preferably the Oracle distribution. SetJDK_HOME
orJPY_JDK_HOME
to point to your JDK installation and run the build script:
$ export JDK_HOME=<your-jdk-dir>$ export JAVA_HOME=$JDK_HOME$ pip install setuptools wheel$ python setup.py build maven bdist_wheel
On success, the wheel is found in thedist
directory.
To deploy thejpy.jar
(if you don't know why you need this step, this is notfor you)::
$ mvn clean deploy -DskipTests=true
SetJDK_HOME
orJPY_JDK_HOME
to point to your JDK installation. You'llneed Windows SDK 7.1 or Visual Studio C++ to build the sources. With WindowsSDK 7.1::
> SET VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\> SET DISTUTILS_USE_SDK=1> C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\setenv /x64 /release> SET JDK_HOME=<your-jdk-dir>> pip install setuptools wheel> python setup.py build maven bdist_wheel
With Visual Studio 14 and higher it is much easier::
> SET VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\> SET JDK_HOME=<your-jdk-dir>> pip install setuptools wheel> python setup.py build maven bdist_wheel
On success, the wheel can be found in thedist
directory.
TBD
The target reader of this section is a jpy developer wishing to release a newjpy version. Note: You need to have Sphinx installed to update thedocumentation.
- Make sure all Javaand Python units tests run green
- Remove the
-SNAPSHOT
qualifier from versions names in both the Mavenpom.xml
andsetup.py
files, and update the version numbers and copyrightyears injpyutil.py
anddoc/conf.py
. - Generate Java API doc by running
mvn javadoc:javadoc
which will updatedirectorydoc/_static
- Update documentation,
cd doc
and runmake html
- http://peterdowns.com/posts/first-time-with-pypi.html
Run:python setup.py build test
This project has adopted theContributor Covenant Code of Conduct.For more information see theCode of Conduct or contactopencode@deephaven.iowith any additional questions or comments.
For instructions on contributing, seeCONTRIBUTING.md.
Some of the details on this README are out of date. Efforts to improve them will be made in the future.