Bindings for Python

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jan 12 13:28:03 UTC 2026


Hi Nir,
Python provides a fairly complete library (libpython) that allows any 
programs compatible with a C interface to call into python.
This library can be jextracted (see [1]), so it is possible to use 
libpython to call Python from Java (via FFM), and, maybe, even to use a 
tool to automate some of the code generation -- although we didn't do 
any deep exploration in this direction.

(There's also Cython, which allows compiling Python code into C -- but I 
believe that path to be more similar to Java/JNI -- e.g. the generated C 
bindings are meant allow Python functions to be implemented in C/C++ -- 
so the resulting code is still meant to be called from Python, not C)

Cheers
Maurizio

[1] - https://github.com/openjdk/jextract/tree/master/samples/python3

On 10/01/2026 15:26, Nir Lisker wrote:
> Hi,
>
> Has interfacing with Python been looked at in the same sense that
> interfacing with Rust can be done with cbindgen? Has it been attempted
> internally and are there any writings on this?
>
> Thanks,
> Nir


More information about the jextract-dev mailing list