The main issue with Boost.Python—and the reason for creating such a similar project—is Boost. Boost is an enormously large and complex suite of utility libraries that works with almost every C++ compiler in existence. This compatibility has its cost: arcane template tricks and workarounds are necessary to support the oldest and buggiest of compiler specimens. Now that C++11-compatible compilers are widely available, this heavy machinery has become an excessively large and unnecessary dependency.

Think of this library as a tiny self-contained version of Boost.Python with everything stripped away that isn't relevant for binding generation. Without comments, the core header files only require ~4K lines of code and depend on Python (2.7 or 3.x, or PyPy2.7 >= 5.7) and the C++ standard library. This compact implementation was possible thanks to some of the new C++11 language features (specifically: tuples, lambda functions and variadic templates). Since its creation, this library has grown beyond Boost.Python in many ways, leading to dramatically simpler binding code in many common situations.

Tutorial and reference documentation is provided at http://pybind11.readthedocs.org/en/master. A PDF version of the manual is available here.

Programming language: C++
Tags: Containers     C++11     Header Only     Python    

Recently added pybind11 resources

Do you know of a usefull tutorial, book or news relevant to pybind11?
Be the first to add one!

pybind11 Recommendations

There are no recommendations yet. Be the first to promote pybind11!

Have you used pybind11? Share your experience. Write a short recommendation and pybind11, you and your project will be promoted on Awesome C++.
Recommend pybind11

pybind11 alternatives and related libraries

Based on the "Containers" category

Do you think we are missing an alternative of pybind11 or a related project?

Add another 'Containers' Library