c2py

c2py is a lightweight C++20 library that provides the runtime support for the Python bindings generated by clair-c2py.

The binding files emitted by clair-c2py (*.wrap.cxx / *.wrap.hxx) are built on top of c2py, which supplies:

  • the type converters between C++ and Python (see Converters),

  • the dynamic-dispatch machinery for overloaded functions,

  • the object model for wrapped C++ classes, and

  • helpers such as c2py::pyref for manipulating Python objects from C++.

It depends only on the Python and NumPy C API and can be compiled with any C++20 compiler, independently of the LLVM/Clang version used by clair-c2py.

Note

The generated bindings are designed to be produced automatically rather than written by hand. The low-level c2py runtime API is therefore not part of the user-facing documentation.