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>
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, 3.13)
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
How To Contribute
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pemja-0.6.1.tar.gz.
File metadata
- Download URL: pemja-0.6.1.tar.gz
- Upload date:
- Size: 55.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88ffcd5427725e12b10c8740e0b061087f5d1a66abef9cf932e3d4821b4033f9
|
|
| MD5 |
c2808c094d12c944d55bbeb40d9e8d53
|
|
| BLAKE2b-256 |
a04950b287accbcbef4ec51feb8125c18182a1da3696ce2c03b0b8ac89c2e373
|
File details
Details for the file pemja-0.6.1-cp313-cp313t-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313t-manylinux1_x86_64.whl
- Upload date:
- Size: 69.1 kB
- Tags: CPython 3.13t
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f2d1aca859067f75a7c261911da8a0b43557ad4a8a2e9abba76549ab53b4982
|
|
| MD5 |
5399cc3bbd6ccea2a1c5d600f2efd404
|
|
| BLAKE2b-256 |
b52319d35b5813e331b205602d74f5b94e3fa35dd3119643e9a0621ffdff22df
|
File details
Details for the file pemja-0.6.1-cp313-cp313t-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313t-macosx_11_0_arm64.whl
- Upload date:
- Size: 57.3 kB
- Tags: CPython 3.13t, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65b50d8f3c94b7d10200fd6f87320f4891bf47d66b022241da202e05e9da8829
|
|
| MD5 |
2a3edce51a76f1805d203a8677dd0e35
|
|
| BLAKE2b-256 |
92f245d347b16e2022b3df357554e8e6e7ed97ead894939d3aa59753dd6a2875
|
File details
Details for the file pemja-0.6.1-cp313-cp313t-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313t-macosx_10_13_x86_64.whl
- Upload date:
- Size: 56.1 kB
- Tags: CPython 3.13t, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69c3e4fc22aaf9226da970a53f04f9698a72f887f5e0cbfa932508f7a5a65917
|
|
| MD5 |
7be8320065ec0158023ace396ea6935c
|
|
| BLAKE2b-256 |
ada6bf5ce7404ab27e2fa5cf48ce8d905e3eafb4600ff7a611c126314b9ac70d
|
File details
Details for the file pemja-0.6.1-cp313-cp313-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313-manylinux1_x86_64.whl
- Upload date:
- Size: 68.9 kB
- Tags: CPython 3.13
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a8bc93c3eb51ddaf394077049fc066db004f49d2e477f1287fd885a34dc342
|
|
| MD5 |
20b585bb9e08ebfec6075bb15f4110d9
|
|
| BLAKE2b-256 |
8d0c739895d6fa5a2358b5253773d2afa1bd0511dec08dfd87f2f0bcb5c7801c
|
File details
Details for the file pemja-0.6.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 56.0 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63a996a48e341d05820945cd95f0d97ab266746681fecee954ebd8d5baf585ed
|
|
| MD5 |
60ba6fdd8958b5063a4ecdb429977287
|
|
| BLAKE2b-256 |
9b6606d4378e02f5769f466d76f1eaab68b354b2ea4c9f8f740b18fc306cc5c1
|
File details
Details for the file pemja-0.6.1-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 54.8 kB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e72bf9f28807f6e80c1d298e4b9d59410340bac9d852567f0dfda87cd52c259
|
|
| MD5 |
54ac8fc78f87386cd879b8f4d72b10b2
|
|
| BLAKE2b-256 |
59364088442a145ab13d37d7418544ef0eed079305060f46ef8a5efb870184be
|
File details
Details for the file pemja-0.6.1-cp312-cp312-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp312-cp312-manylinux1_x86_64.whl
- Upload date:
- Size: 68.9 kB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c13422d442981d5fcf711ad3e1ed038cf9af8e9d7b9ee94937e8e8e54c6c486
|
|
| MD5 |
2b9b8aa5d775bfa1e1f4debd0962eac3
|
|
| BLAKE2b-256 |
eeed31a24c69cd9a381242a7b4c487fc899ab995fd86f40a66d869ba98de2473
|
File details
Details for the file pemja-0.6.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 56.0 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aec85f5c8aff026cc9150c0da95b5e514bb0bc31b6287feb3fbbccbdf596978
|
|
| MD5 |
b28bf887d0667f59a8aa1ba517a03c28
|
|
| BLAKE2b-256 |
bf9219872c60120d2d937e5d8424f573e46c9179e1f58f4a94962cd62d4c40cd
|
File details
Details for the file pemja-0.6.1-cp312-cp312-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 54.8 kB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
248c09d210866b1d89e259a093494f75406693c67144d7218bb9fe97daf20440
|
|
| MD5 |
d1f11bf29f7757e75c6c8a7b8bf6bcd8
|
|
| BLAKE2b-256 |
7e4bc8c7331edfc0dcb56483689c6bcf84bc674c8f2aa59837f25e30f310dcdd
|
File details
Details for the file pemja-0.6.1-cp311-cp311-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp311-cp311-manylinux1_x86_64.whl
- Upload date:
- Size: 67.5 kB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba99140006fab5d1e58373487a04ee529f574f5422e91877cee4f74776ac52e2
|
|
| MD5 |
e6eebb43d739dcafad027bf59d5fffa2
|
|
| BLAKE2b-256 |
53ae20857922e86ce85e799f2512ef843a19fb477796243e21d986962ea94517
|
File details
Details for the file pemja-0.6.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 55.9 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d69fbb0f910b44b591a980364eff1d71ac82edbb12155af729d99c8b45b5d89
|
|
| MD5 |
e1e20e814997ea8a6a1021c725b07aed
|
|
| BLAKE2b-256 |
6c1c5d23496f41894166d66ba7509682326a1edf872031f4c189fcabe521c58b
|
File details
Details for the file pemja-0.6.1-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 54.6 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b234fe975932673a5d63e728a50cf90ea61e336048222d775890403f304f3f5c
|
|
| MD5 |
eba74c794e0d43b9ff067952debaf62c
|
|
| BLAKE2b-256 |
d39f1b6c03dd70a23f3bf725c2016a000a74f250bcf2d61a37c45d2f43057674
|
File details
Details for the file pemja-0.6.1-cp310-cp310-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp310-cp310-manylinux1_x86_64.whl
- Upload date:
- Size: 67.5 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2972ea726164d59c6179baf215861e8c005757dcba520a6288b287a590006436
|
|
| MD5 |
ead5b32bacaaaa0e4e327495e47977b0
|
|
| BLAKE2b-256 |
614d57b602093d58a03532414032914d719d675589a317c45ecea7f45a55defe
|
File details
Details for the file pemja-0.6.1-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 56.1 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdf0f54f056db3cbe71f9bbde62f702e32026b58cef1502e10dcc3343cebecae
|
|
| MD5 |
dd8f8603647dd9ba5405a64cd9ca4ac1
|
|
| BLAKE2b-256 |
5ab53045303c1568f990f0bfd105cbcbc0c210be8ec1ca4a7b297b6c5aa0ac47
|
File details
Details for the file pemja-0.6.1-cp310-cp310-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 54.8 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
157613efa7ab272cdb89120a313fec452aca513246ea34a570e407c8074c8597
|
|
| MD5 |
11833975e84f4880c071dd4fc735fe38
|
|
| BLAKE2b-256 |
93f8232a8380480f4da344fdd9ad09fa1d772d98ebfa6c6b83987627f92378fa
|
File details
Details for the file pemja-0.6.1-cp39-cp39-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 67.6 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
710ed32ca234c93a34d7e43c66345080db27c5748380f1f4a557d00d3c3bb6e4
|
|
| MD5 |
7b67b7ea85a2ba8ceed8ddeaf5e36b7a
|
|
| BLAKE2b-256 |
e81fd3bfc4b257ed2ac733e7542108dac47eabc4ab4f448c46e5be193e170ff9
|
File details
Details for the file pemja-0.6.1-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 56.1 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0d80934bb4a387c3bbdee2124f1f9c7d86f5daca2a6786f98c8b6928d056de6
|
|
| MD5 |
cae48d537bec2effab4c97e4f36f8313
|
|
| BLAKE2b-256 |
317cd6a19e6ca899934a8ce949cc0f9e15e8f52108c6cd5a020af584c59bbf04
|
File details
Details for the file pemja-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 54.8 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32d81dc7a756321c0fc4659899cba2a9c8157702cc0becc39592f3b5b45a189e
|
|
| MD5 |
b461a49915737317e986d725f0d53efe
|
|
| BLAKE2b-256 |
4f1d93ffa9b6bdf6d6bc7bca5bb9266705779e9d483905227f6b527d61d5e114
|
File details
Details for the file pemja-0.6.1-cp38-cp38-manylinux1_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 322.2 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bec2c74777e973afee67aacebaebc5737e53b1fbd713161c8a28149a429cc49
|
|
| MD5 |
0b7d797b9756cc488f0a4797b7d64a0f
|
|
| BLAKE2b-256 |
329ae1046ef63370929ea25fdab7ca2f608721260a03a3db02d92099f3aff65b
|
File details
Details for the file pemja-0.6.1-cp38-cp38-macosx_11_0_arm64.whl.
File metadata
- Download URL: pemja-0.6.1-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 55.7 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48d61a6f6fa2bfd53935650eeb59a8533dcce470678cb0b4e0d50185f303ebe2
|
|
| MD5 |
cacbff0d9d3926aa0173251d917790ad
|
|
| BLAKE2b-256 |
6300487ee673eb6c6ca4eb55f6492eb4c0fe20f48c6228348f034fbf209828ca
|
File details
Details for the file pemja-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pemja-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 54.3 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d137fd2d18309fcfa6a12d56753bacd90bea78e3e946c18cbbc3ff705e88d1
|
|
| MD5 |
18c3eced7fc8de735750fefb5bb97f4d
|
|
| BLAKE2b-256 |
adae372eda8eff0174b281fc45ccdf1c78ca7bf911f823577e9a096a3065e311
|