Skip to main content

PemJaX

Project description

PemJaX

What is it?

PemJa is an open source cross language call framework based on FFI. It aims to provide a high-performance

framework of calling between different languages.

PemJaX is an extension of PemJa , specifically designed to support WindowsOS. This package inherits all the functionalities of PemJa and introduces necessary modifications and enhancements to ensure seamless operation in WindowsOS.

Where to get it

Python binary installers for the latest released version are available at the Python package index

pip install pemjax

Java Maven Dependency

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>pemja</artifactId>
    <version>{version}</version>
</dependency>

Dependencies

Installation from sources

Prerequisites for building PemJa:

  • Unix-like environment (we use Linux, Mac OS X), Windows
  • Git
  • Maven (we recommend version 3.2.5 and require at least 3.1.1)
  • Java 8 or 11 (Java 9 or 10 may work) with $JAVA_HOME correctly set
  • Python >= 3.8 (we recommend version 3.8, 3.9, 3.10, 3.11)

NOTE for windows:

  • Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"
  • The compressed package in folder dist must be uncompressed and use the following command to install pip install dist/$packageName$
git clone https://github.com/IGinX-THU/pemja.git
cd pemja
mvn clean install -DskipTests
pip install -r dev/dev-requirements.txt
python setup.py sdist
pip install dist/*.tar.gz

Usage

String path = ...;
PythonInterpreterConfig config = PythonInterpreterConfig
    .newBuilder()
    .setPythonExec("python3") // specify python exec, use "python" on Windows
    .addPythonPaths(path) // add path to search path
    .build();

PythonInterpreter interpreter = new PythonInterpreter(config);

// set & get
interpreter.set("a", 12345);
interpreter.get("a"); // Object
interpreter.get("a", Integer.class); // Integer

// exec & eval
interpreter.exec("print(a)");

// invoke functions
interpreter.exec("import str_upper");
String result = interpreter.invoke("str_upper.upper", "abcd");
// Object invoke(String name, Object... args);
// Object invoke(String name, Object[] args, Map<String, Object> kwargs);

// invoke object methods
/*
// invoke.py
class A:
       def __init__(self):
           self._a = 0
   
       def get_value(self):
           return self._a
   
       def add(self, n):
           self._a += n
   
       def add_all(self, *args):
           for item in args:
               self._a += item
               return self._a
   
       def minus(self, n):
           self._a -= n
           return self._a
*/

interpreter.exec("import invoke");
interpreter.exec("a = invoke.A()");
interpreter.invokeMethod("a", "add", 3);
interpreter.invokeMethod("a", "minus", 2);
interpreter.invokeMethod("a", "add_all", 1, 2, 3);


// python callback java methods
/*
// invoke_callback.py
from pemja import findClass

StringBuilder = findClass('java.lang.StringBuilder')
Integer = findClass('java.lang.Integer')

def callback_java():
    sb = StringBuilder()
    sb.append('pemja')
    sb.append('java')
    sb.append('python')
    sb.append(Integer.toHexString(Integer.MAX_VALUE))
    return sb.toString()
*/
interpreter.exec("import call_back")
print(interpreter.invoke("call_back.callback_java"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pemjax-0.1.0.tar.gz (52.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pemjax-0.1.0-cp311-cp311-win_amd64.whl (81.6 kB view details)

Uploaded CPython 3.11Windows x86-64

pemjax-0.1.0-cp311-cp311-manylinux1_x86_64.whl (63.9 kB view details)

Uploaded CPython 3.11

pemjax-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (53.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pemjax-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl (53.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pemjax-0.1.0-cp310-cp310-win_amd64.whl (82.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pemjax-0.1.0-cp310-cp310-manylinux1_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.10

pemjax-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (53.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pemjax-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl (53.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pemjax-0.1.0-cp39-cp39-win_amd64.whl (82.4 kB view details)

Uploaded CPython 3.9Windows x86-64

pemjax-0.1.0-cp39-cp39-manylinux1_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.9

pemjax-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (53.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pemjax-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl (53.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pemjax-0.1.0-cp38-cp38-win_amd64.whl (81.8 kB view details)

Uploaded CPython 3.8Windows x86-64

pemjax-0.1.0-cp38-cp38-manylinux1_x86_64.whl (325.6 kB view details)

Uploaded CPython 3.8

pemjax-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (53.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

pemjax-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl (53.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file pemjax-0.1.0.tar.gz.

File metadata

  • Download URL: pemjax-0.1.0.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for pemjax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 597726ed9072a2992edc8f97fb10fdbce449d20c8cdc4edcb3d77a7ebc192aa7
MD5 30ef425e117baf665d21f244cdb8013d
BLAKE2b-256 8c0cbb77e52fb68faa7bfdaa067d1467c42a92f031ca305db1607d34fea1710e

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pemjax-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 81.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for pemjax-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7dc25682683bff93eb0942e3eab9b0470ee2072ff3b6e98e4777f52a4ad26c37
MD5 d3b7be43e8c3bee9350b0e7f73801108
BLAKE2b-256 46176348cfe288f7ca24c89d6d68472d8ca582d2ed622789c5241577aefed425

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 45fd708e9a2fc9f43ed378a6574b5dd8984d543b3f611240828b76de82262244
MD5 3ba698706b89fe7fbec27ffed057a846
BLAKE2b-256 e1e1aa34a43ca87017f8ce3daa790997b86c90099eae8b9482a922cf60c54920

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0cc9226a565f60e21ed7b47573e94c025f9e4a8762888dcb2dd34dba0ed6cce
MD5 88df6f284592a236eb29c6dcceed3df9
BLAKE2b-256 0561243be55c6142588d8e03c4e3e89d69110f4884da79fe31315d1dba103a35

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 589f11c6a7c8c87e79804bcd4274ac91ef225333fa59b3cd533571981811c953
MD5 d07e0decde15a4e1195c4a71599ecf5d
BLAKE2b-256 9375a847f50ade78aa9281d2e9a7d6520ce1905afce0b8a0c7ddf6adadd02622

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pemjax-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for pemjax-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f37fef134c1685bda6888222a271f223765f714726d850a87b3b21da18e3f936
MD5 04c24c836ad9ea4d6b906d3a0b603bec
BLAKE2b-256 ff0bf4996ec77967259838f0b7d5c23f48a0dc63907db1473457ea079891da92

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8e38192546baf2327887e0aaf63234c82f05884c72159c4ed5476b1d3983c724
MD5 458fdece985af2092b114e9362011452
BLAKE2b-256 cecb138585d0d8e9433539859e55d501e8d472c5e9d4560c6cf2b456f4c943cc

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13089d734a415fb08fa3e29179b17e91fee5594ae8c51fafad1e8a25595876fb
MD5 5935dc25936acd1db3657e71c4912446
BLAKE2b-256 fb4a7d21921ed5fbb7768c6e8bf67322ba458cbfa30bdee1d2f5ca4e0efd2ba7

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 89a9e4c5d872ef2a167c9f2364a6c7a09e3a42d60fc9011be0cd69211dbd8c52
MD5 0b293a224f18e32c2c190651e6c82495
BLAKE2b-256 1cfaaa48b82981ee33795398c08d87a279affe1d2575a78cef69b20c3ef1fd02

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pemjax-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 82.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for pemjax-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bbe6f2335e18fc33803cee6fc1fbfd21dfc77e86a6a870c97dccf398b0f70e33
MD5 6a1fa25d1718c50cc9a3a1257e64c3a8
BLAKE2b-256 6675804392416d65f7669ccc10bc0e5cbb1b66138224ab6ed5430f35d1e457e6

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b90eb39f7f0191dbe609882d5f0e24a053d501892a0bb300deb0bac6b1804379
MD5 550f4370aebb783fbfaa86ccb677c2ce
BLAKE2b-256 6c9926c1d0b4745ebb96aa461b9cede90b4f22b2395ec4169ecb06b4fee8fb1f

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 204b09fdca9d390150cb01b6ee851e2ce5fb32c57cbc81cac9bbfb83f02ba6a9
MD5 c1745f011e4e871b8ea9775d300e1343
BLAKE2b-256 9bf68f03832cc669bbd4a03b40e6c0255fb8d6d8737453a40589e338b2901bd5

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1f4b6909bb39e1f262a530545625dfbf043ce4cb81d08cb55f4ef51f00d9ce85
MD5 79bb1b0582cbf7b5a14842555b42f94f
BLAKE2b-256 c1ba0bdf0dd4140c4cc2f133b6005f26ec52a5b5fbd2a640d2a4724ad30f3b32

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pemjax-0.1.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 81.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for pemjax-0.1.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a71d66cfeb0354ce1d8a7ef768497d688072751f5c78860bbbf3a33a2aea92a7
MD5 0bc96ee906e685b506ad31ed002ac376
BLAKE2b-256 5933afef65372a64bf88f823ac15e2ae9cab12832a812ecedbc2021e2720430f

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eab0ea5cf132acc0b9ea38245e408c0a58594a9b7b89d0fa7e42571da21fe3e9
MD5 acaec29f91bf763a635adebdda0c938e
BLAKE2b-256 fc4d02b96f07f3bd783f5acb1ff115cd3afc16ff9da026c9d7df4f376ee0ecd4

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3dd79a7d237fb3bc202ce40d8518fc8c61f7f8ff055a4cb40dcf198d9859180a
MD5 b345559efab28a25183d7858b8c43364
BLAKE2b-256 96f3f3d6c86a748af47379d385e28fb993830fe64b697c3724e4bcd074cacd44

See more details on using hashes here.

File details

Details for the file pemjax-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemjax-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f7ac1e964e5e8d30faa796f52e33e245737a4ef552f22fc6a34874cf1da13705
MD5 69ed3b80f19dc9f9ffd8d5429e486fb4
BLAKE2b-256 38efa62e2b6e2ec783d93a60b2786dff4c137e6cabc9b5cef25cf5c6ac934a54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page