Extend and Embed Python with C++
summary
Shows exact mechanics: building a PIC shared library, calling it from Python with ctypes, generating wrappers with SWIG, and writing idiomatic bindings with pybind11; demonstrates a native C extension, a SWIG-generated .py/.c wrapper, and C++ class bindings with constructors, methods, inheritance and a __repr__-style printer that actually work. Covers embedding a Python interpreter in a C program, calling Python functions and returning values, discusses GIL workarounds, build hassles and a real-world frozen-Python deployment used for automation.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:06Why extend and embed Python with C++
- 4:16Extending Python with ctypes
- 10:20Python extension modules in C
- 16:23Automating bindings with SWIG
- 19:53Extending Python with pybind11
- 22:23Key features of pybind11
- 32:26Embedding Python in C++
- 34:38Methods for embedding Python
- 42:27Summary and recommendations
- 44:15Q&A
- 47:25Boilerplate reduction tools
- 49:30Debugging interoperability
- 50:38Handling out parameters
- 53:15Support for templates in pybind11
- 54:38Binding non-copyable types
- 57:23Embedding Python interpreter
- 59:50Static linking and frozen Python
related talks
36mIntroduction to C++ python extensions and embedding Python in C++ Apps
25mHow to bring your C++ project to Python land
01h 51m'Extending and Wrapping C and C++ with Python' - Diego Rodriguez-Losada [ ACCU 2016 ]
01h 02mWriting Python Bindings for C++ Libraries: Easy-to-use Performance
29mThe Art of Extending Python with other languages
29mC++ ♥ Python: from modules to hybrid applications
36mPython, C, C++, and Fortran Relationship Status: It’s Not That Complicated
24mA tale of Python C extensions and cross-platform wheels
