pybind11
Seamless operability between C++11 and Python
Decision gist · record as of 2026-08-14
Yes. pybind11 is production-stable, actively maintained, widely adopted, and has zero known vulnerabilities. Install it when you need to create Python bindings for C++ code or wrap existing C++ libraries. It is a build-time dependency, not a runtime one, so it adds no overhead to deployed applications. The permissive BSD-3-Clause license poses no restrictions for most use cases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a C++11-compatible compiler and Python development headers; used as a build-time dependency in extension modules rather than imported directly at runtime.
- Installation is straightforward with no runtime dependencies.
- The package is actively maintained with a recent release and has strong community adoption with 17991 GitHub stars.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions; you must include the license text in distributions.
last release 2026-08-06 (8 days) · last repo commit 2026-08-12 · 17,991 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 29,672,883 downloads/mo, #810 on PyPI
Alternatives
Verify before relying
pip install pybind11==3.1.0
# In a C++ source file:
#include <pybind11/pybind11.h>
PYBIND11_MODULE(mymodule, m) {
m.def("add", [](int a, int b) { return a + b; });
}- Whether NumPy 2 compatibility requires pybind11 2.12+ as stated in the description.
- Performance characteristics and binary size reduction claims relative to Boost.Python in real-world projects.
- Specific compiler and platform combinations beyond those listed in the GitHub Actions test matrix.
What it is and what it does
pybind11 is a lightweight header-only library designed to bridge C++ and Python by automatically generating Python bindings for C++ code. It works by exposing C++ types, functions, classes, and standard library containers to Python with minimal boilerplate, using compile-time introspection to infer type information. The library supports modern C++11 features like lambda functions, move semantics, and variadic templates, making binding code simpler than older approaches like Boost.Python.
Typically used as a build-time dependency in projects that need to wrap existing C++ libraries or accelerate performance-critical Python code by implementing hot paths in C++. It requires Python 3.9 or later (CPython, PyPy, or GraalPy) and a C++11-compatible compiler, but has no runtime dependencies. The library handles complex C++ features including custom operators, inheritance, virtual methods, smart pointers, and NumPy array integration, making it suitable for scientific computing, data processing, and systems programming where C++ performance meets Python usability.
Use it for
- Wrap existing C++ libraries to make them callable from Python without rewriting in Python.
- Accelerate performance-critical sections of Python applications by implementing them in C++.
- Create Python interfaces for C++ numerical libraries and integrate them with NumPy arrays.
- Build Python extensions for real-time systems, game engines, or low-level hardware control.
- Expose C++ class hierarchies and virtual methods to Python for object-oriented interoperability.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
pybind11 is production-stable, actively maintained, widely adopted, and has zero known vulnerabilities. Install it when you need to create Python bindings for C++ code or wrap existing C++ libraries. It is a build-time dependency, not a runtime one, so it adds no overhead to deployed applications. The permissive BSD-3-Clause license poses no restrictions for most use cases.
Install
pybind11 on PyPI
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained with a recent release and has strong community adoption with 17991 GitHub stars.
Requires a C++11-compatible compiler and Python development headers; used as a build-time dependency in extension modules rather than imported directly at runtime.
License in practice
BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions; you must include the license text in distributions.
Quickstart
pip install pybind11==3.1.0
# In a C++ source file:
#include <pybind11/pybind11.h>
PYBIND11_MODULE(mymodule, m) {
m.def("add", [](int a, int b) { return a + b; });
}
Verify before relying
- Whether NumPy 2 compatibility requires pybind11 2.12+ as stated in the description.
- Performance characteristics and binary size reduction claims relative to Boost.Python in real-world projects.
- Specific compiler and platform combinations beyond those listed in the GitHub Actions test matrix.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 29,672,883 / month, #810 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: C++Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities |
Evidence: pybind11-3.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “create Python bindings C++”
- pybind11pybind11 is a header-only C++ library that creates Python bindings…
- pybind11-globalA header-only C++ library that generates Python bindings for C++…
- mfusepymfusepy provides Python bindings to libfuse 2 and 3, enabling you to…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also cppy · nanobind · pybind11-global · pytango · PyBindGen · ccimport · pybind11-stubgen · cxxheaderparser · eigenpy · pydemumble