Giter Site home page Giter Site logo

klodovsky / jpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bcdev/jpy

0.0 0.0 0.0 2.25 MB

A bi-directional Python-Java bridge used to embed Java in CPython or the other way round.

License: Apache License 2.0

Shell 0.39% C 53.91% Python 18.67% Java 25.94% Batchfile 0.42% C++ 0.66%

jpy's Introduction

Build Status Documentation Status

❗ Note on jpy development status

Currently, jpy is not being actively developed. New issues and pull requests are welcome, but we cannot guarantee to respond to them in a timely manner.

jpy - a Python-Java Bridge

jpy is a bi-directional Python-Java bridge which you can use to embed Java code in Python programs or the other way round. It has been designed particularly with regard to maximum data transfer speed between the two languages. 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 via Python buffers (e.g. Numpy arrays)
  • Support of Java methods that modify primitive Java array parameters (mutable parameters)
  • Java arrays translate into Python sequence objects
  • Java API for accessing Python objects (jpy.jar)

jpy has been tested with Python 3.4–3.8 and OpenJDK 8 on 64-bit Ubuntu Linux, Windows 10, and macOS.

The initial development of jpy was driven by the need to write Python extensions to an established scientific imaging application programmed in Java, namely the SNAP toolbox, the SeNtinel Application Platform project, funded by the European Space Agency (ESA). (jpy is bundled with the SNAP distribution.)

Writing such Python plug-ins for a Java application usually requires a bi-directional communication between Python and Java since the Python extension code must be able to call back into the Java APIs.

For more information please have a look into jpy's

How to build wheels for Linux and Mac

Install a JDK 8, preferably the Oracle distribution. Set JDK_HOME or JPY_JDK_HOME to point to your JDK installation and run the build script:

$ export JDK_HOME=<your-jdk-dir>
$ export JAVA_HOME=$JDK_HOME
$ python setup.py build maven bdist_wheel

On success, the wheel is found in the dist directory.

To deploy the jpy.jar (if you don't know why you need this step, this is not for you)::

$ mvn clean deploy -DskipTests=true

How to build a wheel for Windows

Set JDK_HOME or JPY_JDK_HOME to point to your JDK installation. You'll need Windows SDK 7.1 or Visual Studio C++ to build the sources. With Windows SDK 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>
> 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>
> python setup.py build maven bdist_wheel

On success, the wheel can be found in the dist directory.

How to install from sources

TBD

Releasing jpy

The target reader of this section is a jpy developer wishing to release a new jpy version. Note: You need to have Sphinx installed to update the documentation.

  1. Make sure all Java and Python units tests run green
  2. Remove the -SNAPSHOT qualifier from versions names in both the Maven pom.xml and setup.py files, and update the version numbers and copyright years in jpyutil.py and doc/conf.py.
  3. Generate Java API doc by running mvn javadoc:javadoc which will update directory doc/_static
  4. Update documentation, cd doc and run make html
  5. http://peterdowns.com/posts/first-time-with-pypi.html

Automated builds

As of 2020-08-27, Python wheel packages for jpy are automatically built on AppVeyor, but at present they are uploaded only to a private FTP server and not publicly released. Wheels are built for Python versions 3.4, 3.5, 3.6, 3.7, and 3.8 on Linux, Windows, and macOS (≥10.9). Only 64-bit wheels are built.

The repository also contains an outdated configuration for automated Travis builds, but this configuration is currently unmaintained and broken.

jpy's People

Contributors

chipkent avatar cpwright avatar dependabot[bot] avatar desruisseaux avatar devinrsmith avatar dr-irv avatar forman avatar gbaier avatar heptaflar avatar marpet avatar mzuehlke avatar olgafaber avatar pont-us avatar thomasstorm avatar voutilad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.