--- id: pybind11-global version: "3.1.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # pybind11-global — Seamless operability between C++11 and Python License: permissive · Maintenance: active · Downloads: 579.4K/mo ## 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 above — 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 pip install pybind11-global uv add pybind11-global poetry add pybind11-global ## Installing 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_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_current - Install friction: low - Maintenance: active - Downloads: 579.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags C++ to Python bindings, Python C++ interoperability, create Python extensions C++, bind C++ classes to Python, C++11 Python wrapper, NumPy C++ integration, lightweight binding library, c++-bindings, extension-modules, performance [View on SkillFed](https://skillfed.io/packages/pybind11-global) · [View on PyPI](https://pypi.org/project/pybind11-global/)