Generating Python bindings to C++ libraries
summary
Generates Python bindings by auto‑producing pybind11 code from C++ headers using a Python C++ parser, YAML + Jinja2 templates and a bespoke robotpy-build system that packages shared libraries and loads them with ctypes. Handles cross‑module classes, uses pybind11 keep_alive for lifetimes and injects a custom __repr__. CI builds wheels for three OSes and supported CPython versions producing 15 wheels, accepts manual work for heavily templated code via manual template instantiations, and deliberately avoids binding system libraries.
AI-written summary · about
chapters (9)
- 0:00Python C++ bindings intro
- 1:03Why generate Python bindings
- 3:54Existing binding tools
- 6:50pybind11 introduction
- 9:43Automating pybind11 code
- 15:38RobotPi build overview
- 21:39Customizing bindings
- 23:10Packaging libraries
- 26:22Questions and answers
related talks
15mUsing Reflection to Generate C++ Python Bindings
01h 02mWriting Python Bindings for C++ Libraries: Easy-to-use Performance
05mPybind11 - Python on Steroids
40mBuilding a binary extension
48mIntegrate Python and C++ with pybind11
24mA tale of Python C extensions and cross-platform wheels
49mHow to build Python-C++ libraries
25mHow to bring your C++ project to Python land
