Skip to main content

PemJa

Project description

PemJa

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.

Where to get it

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

pip install pemja

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 set correctly
  • Python >= 3.8 (we recommend version 3.8, 3.9, 3.10, 3.11, 3.12)

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/alibaba/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"))

Documentation

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

pemja-0.5.7.tar.gz (53.2 kB view details)

Uploaded Source

Built Distributions

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

pemja-0.5.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (307.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pemja-0.5.7-cp312-cp312-manylinux1_x86_64.whl (65.7 kB view details)

Uploaded CPython 3.12

pemja-0.5.7-cp312-cp312-macosx_11_0_arm64.whl (53.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pemja-0.5.7-cp312-cp312-macosx_10_9_x86_64.whl (52.1 kB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pemja-0.5.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (303.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pemja-0.5.7-cp311-cp311-manylinux1_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.11

pemja-0.5.7-cp311-cp311-macosx_11_0_arm64.whl (53.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pemja-0.5.7-cp311-cp311-macosx_10_9_x86_64.whl (51.7 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pemja-0.5.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (299.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

pemja-0.5.7-cp310-cp310-manylinux1_x86_64.whl (64.4 kB view details)

Uploaded CPython 3.10

pemja-0.5.7-cp310-cp310-macosx_11_0_arm64.whl (53.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pemja-0.5.7-cp310-cp310-macosx_10_9_x86_64.whl (51.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pemja-0.5.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (297.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

pemja-0.5.7-cp39-cp39-manylinux1_x86_64.whl (64.5 kB view details)

Uploaded CPython 3.9

pemja-0.5.7-cp39-cp39-macosx_11_0_arm64.whl (53.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pemja-0.5.7-cp39-cp39-macosx_10_9_x86_64.whl (51.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pemja-0.5.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (292.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

pemja-0.5.7-cp38-cp38-manylinux1_x86_64.whl (301.2 kB view details)

Uploaded CPython 3.8

pemja-0.5.7-cp38-cp38-macosx_11_0_arm64.whl (53.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

pemja-0.5.7-cp38-cp38-macosx_10_9_x86_64.whl (51.7 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file pemja-0.5.7.tar.gz.

File metadata

  • Download URL: pemja-0.5.7.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pemja-0.5.7.tar.gz
Algorithm Hash digest
SHA256 319053aec006fb38bb3147f8048eb0a0edf530578a8f3287c60d658814cada61
MD5 c1ac272b649dce3087fc4bfb4e99465a
BLAKE2b-256 083e8b5f872c43312c73ff9584feb36736cd4001bffb68921e6de9fed83753e3

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7905377e8b9e3f9110890641e692449e3d92fe51cf96f4c7d42acecbd08f83d
MD5 6568f9be5e3958ae8e32ef3e2d9235be
BLAKE2b-256 60c59fa4b3288ee51ad4c58015f29a7dd39f21555a64ea05bc7a93e80fbffecf

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp312-cp312-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp312-cp312-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 04e6fd1836ad4d72b5d2a816dec27f63034e4e5881f8452324c640ea0d5d95c7
MD5 fedd1da453414d6e6aa0fddb2aad0e7a
BLAKE2b-256 d98385619ae608e285fedddb097ca825913b9c067f87198410582cebccb42272

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b05da752a7ed22d8f01c66d7b479f1390132b9773390da8e3ecd87cc19a0ba3
MD5 a92129e45b1ad60e8c987e6fc2b0cf28
BLAKE2b-256 a01bced76eb1290551c79380ecac0b1ef049fe8379261b6eba51021fb166212a

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5501699efa2595607db5edb0342d7ea0745559a383e5fc816b4e7bc8b059548d
MD5 1165409927a8b0d9fa3a31a6086a6306
BLAKE2b-256 d3094ade4f99ed52fc7ce3f088df257323615421c0d4462c8a639ac9bb70ee53

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 404163d79880f2392c70a787b307ee3cda2bf3d40814f585ce2ca2d54e429e31
MD5 7383eb7d746d7a395110a5936d022c25
BLAKE2b-256 d903aec7c1922037ff5c69c7c784e04db403982d5cd07cb225238e950e7ab4fd

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e423e4bbf937110e1d7be8358f5d69c7b5483b51de4ff373ec762f20001056b7
MD5 b29553f2527bbf7d95347c8875ada8a3
BLAKE2b-256 94980df8439a00372a0e628907c4f5894b38f1a60e03abbfc560bc1effe3495e

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a53682e4bc7c8abb09a5e72860f3e30bcbc948ce788ce2fce6842638e011e9a
MD5 5dc6abfbd9dbf9a2f880765f5f78283f
BLAKE2b-256 cf3d9e56422ebae7d0b733311a906dc1b2c7aa9b06ede53405a3ef5c191e4ee5

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8a251230aac967967b2ec9cce817c43877097771b876a3717453dd392c7dad33
MD5 eae4bd50b0deef9768fd668ac2cd8285
BLAKE2b-256 f4c61f131659ae317c6a869217c990e40e19645876c00d6d679185a7e1f47a22

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 589133b808c8c6ab0d6916f527bdff437249be34042348559b98192b2b331201
MD5 56dcdc0a5aeffa89595f9ab5343f884b
BLAKE2b-256 7f756da55b23a5fe0ae594e9a12db270eaf6f84233df0cea3c856fb16a7fb466

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b364af46fb9211c86dba8750add7d37a65ea7b68fe780805954ecc34c7e7cd47
MD5 b6da62753682cce7108c3aa26c159dac
BLAKE2b-256 5e829f2273f2def588520d3fb5d0d11ac50ef46b1ee2ad3dc5e46e4b91660227

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7439447bbafec5b4a0a957de79abda64dce906e5f3fdaf1664d82359619f82b
MD5 eb3a33844c5fbc868df95429b46c78d8
BLAKE2b-256 c1a6ed4ee7ff165a9bc73ee5c5c839e877a5d54aa78a0c1f6d5cd34251ce3935

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1503db7afa09d9c0a95fe672467fbf8a7391a2513ff2bf2c77b8afe476ac08fd
MD5 014d5d2ab0b4d391ca1621028857bf70
BLAKE2b-256 d4332f582b7f2103df29a43d355a2f4eeebd8c2c63bdc0c66a733b5c4e14333e

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f7c94234ed531cbec465e4aaebbc20364676db820ec323304c063307ff5a09a
MD5 a5b4680751c25832f576d56a5a0c3150
BLAKE2b-256 0df8c72474a01e7402635d936eeb934e7684da2d49452feeb039d738a3989b18

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0109f31f80d67f2306abb78c3cd5cce4945de5e50e4afcf1f2e5954bbcb6531c
MD5 e3b57b3b71e61760109f8763694ccaae
BLAKE2b-256 81004a22a35d873e93d16c8e3483bff6ec0f73f08fdacd0b66c7ed8e70788ea5

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pemja-0.5.7-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 53.4 kB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pemja-0.5.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf9ebd2437ff609e3ccdcdfd60ea7d822906ba50e46f6500aa1f9a40f970112f
MD5 c18504b8ccf4b601c187689820be2236
BLAKE2b-256 ef8d3976cc30fee2fec299041311ba066a190b14af7ad2b37e6eded83d8355ed

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d4f3a62347d3d59c932f9220dd07fc0a204e5d5d5bac60682e9b72a8e76b8a35
MD5 8e22cf90a75492678de6ad058bf0e9bc
BLAKE2b-256 16bc3290456239e05a8810edb93605c395681ddb0382327fb8464e87a851e361

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 53470f8754b836b0cd8734264c3c05dd6c82c3db3182f1ef577ec30c1e96c71c
MD5 8393afee413a8536e5c77b0bc1543159
BLAKE2b-256 ee4a28987cea4115cd0abfa2bb64b60dac37c3be22c4e9058563b1666ea4ec44

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6d4167632f3c3338de018bd2eb8a797ce7be998251824bfc90bb55ec33acab1e
MD5 053d169c13804ef70eb2e9554ab8d228
BLAKE2b-256 fd57b1f336ae09f78a64475e011f8b7c1da75efba6052829ab79c30534b34e8c

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pemja-0.5.7-cp38-cp38-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: CPython 3.8, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pemja-0.5.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89dfe23bba39542f96128708f32cbf6b26243c55382617f31609b8cd7f2acda9
MD5 b1bf71ed45a79418baa1b2cdabe4f5a0
BLAKE2b-256 54d98db2b61955ebe190798286f9941f9b3074cdeb0dceea5b8f5abe0efc4baf

See more details on using hashes here.

File details

Details for the file pemja-0.5.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pemja-0.5.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5238da637e3cb30e0b6025c8b728441a2edadcb79b5596563bc957c8f60b6e58
MD5 07cd365eae3683cd254ae75ed4654d42
BLAKE2b-256 d62e1f2e64862a71c3f26fef1c8fac2d9d7aa0472b4b9f520e48dcf0662f5325

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