pybind11-global
Seamless operability between C++11 and Python
What it is and what it does
This is a header-only C++ library that exposes C++ types, functions, and classes to Python with minimal boilerplate code. It works by using compile-time introspection to infer type information, allowing binding code that is dramatically simpler than traditional extension modules. The library supports custom data structures, instance and static methods, overloaded functions, exceptions, enumerations, callbacks, iterators, custom operators, single and multiple inheritance, STL containers, smart pointers, and virtual methods. It also integrates with NumPy for efficient array handling and can automatically vectorize functions across array arguments.
The core implementation is compact—only ~4K lines of code—and depends only on Python (CPython 3.9+, PyPy, or GraalPy) and the C++ standard library. This makes it far lighter than comparable alternatives while offering comparable or superior functionality. Binaries are typically smaller by a factor of at least 2, with faster compile times. The library is actively maintained, widely used in scientific and systems projects, and supports modern Python versions.
Use it for:
- Wrap existing C++ libraries to use them from Python without rewriting in Python.
- Create high-performance Python extensions for computationally intensive code by writing the hot path in C++.
- Integrate C++ libraries with NumPy arrays for seamless data exchange.
- Expose C++ class hierarchies and virtual methods to Python, allowing subclassing and polymorphism.
- Build Python packages that leverage legacy C++ codebases or third-party C++ libraries.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A header-only C++ library that generates Python bindings for C++ code, mapping C++ types, functions, classes, and STL containers to Python with minimal boilerplate.
Yes. This is production-ready, actively maintained, and the standard choice for binding C++ to Python when wrapping existing C++ code or accelerating Python with compiled C++. Install it if building Python extensions in C++ or integrating C++ libraries into Python projects. Low install friction, permissive license, and zero runtime dependencies make it a safe, practical choice.
Install
pybind11-global on PyPI
pip
pip install pybind11-globaluv
uv add pybind11-globalpoetry
poetry add pybind11-globalInstalling pybind11-global
Before you install
Installation is straightforward—a pure wheel with no compiled dependencies. The project is actively maintained with a release 8 days old and strong community backing (17995 stars), making it reliable for production use.
License in practice
BSD-3-Clause is permissive and imposes no restrictions on commercial or proprietary use; you may use, modify, and distribute bindings freely provided you retain the license notice.
Quickstart
pip install pybind11-global
# In a C++ file:
#include <pybind11/pybind11.h>
PYBIND11_MODULE(mymodule, m) {
m.def("add", [](int a, int b) { return a + b; });
}
Requires a C++11-compatible compiler and Python development headers; a compilation step is necessary (typically via setuptools, scikit-build, or CMake).
Verify before relying
- Specific performance characteristics compared to hand-written extension modules for simple bindings.
- Practical guidance on when this library is preferable to ctypes or CFFI for particular use cases.
- Coverage details for less common compiler and platform combinations beyond the CI 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 | 579,435/month — #5,918 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pybind11_global-3.1.0-py3-none-any.whl
Keywords: C++11, Python bindings
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
nanobindnanobind exposes C++ types in Python and vice…
permissive · top 5,000 on PyPI
pybind11pybind11 is a header-only C++ library that…
permissive · top 1,000 on PyPI
PyBindGenPyBindGen generates clean C or C++ code that…
copyleft · top 15,000 on PyPI
cppyCppy is a C++ header library that simplifies…
permissive · top 15,000 on PyPI
ccimportccimport builds Python C++ bindings on-the-fly…
permissive · top 15,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
cxxheaderparserParses C++ header files into Python data…
permissive · top 15,000 on PyPI
pybind11-stubgenGenerates PEP 561 type stubs for Python binary…
permissive · top 5,000 on PyPI
eigenpyEigenPy provides Python bindings between NumPy…
permissive · top 5,000 on PyPI
pydemumbleProvides Python bindings to demumble, a tool…
permissive · top 15,000 on PyPI