Back to 2015-proposals
Title: Integrating Python and C++ with Boost.Python
Proposer: Austin Bingham
Type: Workshop
Duration: 360 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 tutorial 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
quickly 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.
After this introduction, the rest of the tutorial will involve writing code to explore various elements of
Boost.Python. We'll focus on techniques for extending Python with C++, that is, writing Python modules
in C++. Boost.Python can be used for embedding (i.e. invoking Python code from C++), but that involves a
different set of techniques, and in practice most scientific Python developers are more interested in
developing extensions.
JJ: Proposed as 1/2 day workshop - have emailed to ask if he meant all day