Back to 2014-proposals
Title: Complementary Visions: Integrating C++ and Python with Boost.Python
Proposer: Austin Bingham
Type: Tutorial
Duration: 90 mins
Description:
Python and C++ are both popular languages that each bring a lot to the table. The languages also complement one another well: Python is high-level, dynamic, and easy to use while C++ is at-the-metal, static, and (in)famously tricky. There are times when there are real advantages to combining these disparate natures, and Python's C API provides a strong interface for doing just that. Boost.Python is a C++ library that builds upon and improves Python's C API to give users a simpler, more intuitive, and safer means to integrate Python and C++.
In this talk we'll look at how to use Boost.Python to effectively bridge the Python/C++ boundary.
We'll start by briefly looking at the fundamentals of the Python C API since that defines the 'ground rules'; this includes things like reference counting, the basic object model, and so forth. We'll then take a look at the Boost.Python API and show how it provides the same functionality as the underlying C API, but does so in a way that doesn't obscure the real semantics of the Python language.
Specific topics in this talk will include:
Exposing classes across the language boundary
Proper exception handling techniques
Module initialization
Packaging and code structure
Debugging and profiling
Negotiating the very different type system
Compilation and linking requirements
We'll look at using Boost.Python for both extending Python (using C++ code in Python) and embedding it (using Python code from C++.) Audience members will learn enough to do fairly sophisticated Python/C++ integration right away, they'll see how easy it is to use Python rather than 'greenspunning' their own language, and they'll get the orientation they need in order to learn the rest of what there is to know.
JJ: Austin writes - I've given 45 minute talks on subsets of the topic, though, so it can easily be reduced if necessary.