The cppyy package integrates the Clang/LLVM-based Cling C++ interpreter into Python, providing interactive access to C/C++ from Python. Using precompiled modules, a class loader, and an everything-lazy implementation, cppyy is designed for automatically binding large scale C++ programs. PyPy supports cppyy natively for high performance, as described in this PyHPC'16 paper.
Thanks to LLVM's JIT, cppyy supports embedded C++ code, automatic template instantiations, auto-downcasting, etc., etc. Where possible, C++ idioms are automatically recognized and pythonized. If necessary, a pythonization API provides further fine tuning for memory ownership, threading, and application-specific conversions. Example:
1 >>> import cppyy
2 >>> cppyy.cppdef("""
3 ... class MyClass {
4 ... public:
5 ... MyClass(int i) : m_data(i) {}
6 ... int m_data;
7 ... };""") # defines a new C++ class
8 >>> from cppyy.gbl import MyClass # bound on-the-fly
9 >>> v = cppyy.gbl.std.vector[MyClass]() # template generated
10 >>> v += [MyClass(i) for i in range(3)]
11 >>> len(v)
12 3
13 >>> for m in v: # idiomatically mapped
14 ... print(m.m_data)
15 ...
16 0
17 1
18 2
19 # create a C++ function on the fly and attach on the Python side
20 >>> cppyy.cppdef("auto add_int = [](MyClass* m, int a) { return m->m_data + a; };")
21 >>> MyClass.add_int = lambda self, i: cppyy.gbl.add_int(self, i)
22 >>> for m in v:
23 ... print(m.add_int(1))
24 ...
25 1
26 2
27 3
28 >>>
Full details in the cppyy documentation: http://cppyy.readthedocs.io