The [[http://cppyy.readthedocs.io|cppyy]] package provides fast, automatic, Python-C++ bindings, including run-time instantiation of C++ templates, cross-inheritance, callbacks, auto-casting, transparent use of smart pointers, etc., etc. Many C++ idioms are automatically recognized and "pythonized" (given a Python look-and-feel), allowing drop-in placement in Python idioms and integration with standard libraries such as NumPy and ctypes. Most importantly it makes it possible to write higher-level (with ownership, threading, and application-specific rules) Python modules on top of C++ in pure Python, without the need to learn an intermediate language or language extension. Cppyy works by integrating the Clang/LLVM-based [[https://github.com/vgvassilev/cling|Cling C++ interpreter]], providing interactive access to C/C++ from Python. It enables calling C++ from Python and calling Python from C++. Using precompiled modules, a class loader, and an everything-lazy implementation, cppyy is designed for automatic generation of Python bindings for large scale C++ programs. PyPy supports cppyy natively for high performance, as described in this [[http://wlav.web.cern.ch/wlav/Cppyy_LavrijsenDutta_PyHPC16.pdf|PyHPC'16]] paper. An example session follows: {{{#!highlight python >>> import cppyy >>> cppyy.cppdef(""" ... class MyClass { ... public: ... MyClass(int i) : m_data(i) {} ... virtual ~MyClass() {} ... virtual int add_int(int i) { return m_data + i; } ... int m_data; ... };""") # defines a new C++ class >>> from cppyy.gbl import MyClass # bound on-the-fly >>> v = cppyy.gbl.std.vector[MyClass]() # template generated >>> v += [MyClass(i) for i in range(2)] >>> len(v) 2 >>> for m in v: # idiomatically mapped ... print(m.m_data) ... 0 1 # create a C++ function on the fly and attach on the Python side >>> cppyy.cppdef("auto add_int = [](MyClass* m, int a) { return m->m_data + a; };") >>> MyClass.add_int = lambda self, i: cppyy.gbl.add_int(self, i) >>> for m in v: ... print(m.add_int(1)) ... 1 2 # cross inheritence (CPython only for now) >>> class PyMyClass(MyClass): ... def add_int(self, i): ... return self.m_data + 2*i ... # helper on C++ side to show inheritence >>> cppyy.cppdef("int callback(MyClass* m, int i) { return m->add_int(i); }") >>> cppyy.gbl.callback(m, 2) # calls C++ add_int 3 >>> cppyy.gbl.callback(PyMyClass(1), 2) # calls Python-side override 5 }}} Source and wheels (for ManyLinux, Mac, and Windows 32b and 64b) are available on PyPI. To install, run: {{{ $ python -m pip install cppyy }}} If you prefer conda, cpppy is also available from conda-forge for Linux and Mac: {{{ $ conda install -c conda-forge cppyy }}} Full details are in the cppyy documentation: http://cppyy.readthedocs.io