This directory contains the code for compiling the Python bindings for Genesis. It should not be necessary for users to re-generate the bindings files here; we create them during development, so that on the user-end they only need to be compiled, which is done automatically via the CMake setup.
The bindings are auto-generated by binder and use pybind11 for interfacing between C++ and Python.
The infrastructure for the bindings was originally created by Ioannis Reppas. This includes the binder configuration, the additional custom binding functions for parts that are not covered by binder, as well as a port of most test cases to Python, in order to verify that the bindings work.
As of the writing of this (July 2025), binder is a bit tricky to set up, and none of the documented install instructions have worked for us on Ubuntu 24 LTS.
Furthermore, we switched to our own fork of Binder, which currently contains extensions that are not yet available in the main repository. The respective PRs might be merged at some point, but until further notice, we use our fork here.
Setup:
- Get our Binder fork and check out the
devbranch. - Install the Python dev libraries:
sudo apt install python3-dev - Build binder:
python3 ./build.py -j 8 --llvm-version 14.0.5
This build command will tell you where the binder executable is.
With binder in place, we can generate our bindings. The easiest way is to add a symlink to the binder executable into this python directory here:
ln -s /path/to/binder/.../binder /path/to/genesis/python/binder
Then, the make_bindings.py script can be called, which executes binder and writes out all files.
The script automatically generates the bindings directory; the files in that directory should hence not be edited or changed manually, as they will be overwritten when the script is called.
Once the bindings files are generated, the compilation is taken care of by CMake. This is the normal use case for end-users.