skillfed

pybind11-global

Seamless operability between C++11 and Python

pybind11-global v3.1.0 579.4K downloads/30d#5,918 on PyPI17,995
Permissive license BSD-3-Clause Active released

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-global

uv

uv add pybind11-global

poetry

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/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

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

Tags

C++ to Python bindingsPython C++ interoperabilitycreate Python extensions C++bind C++ classes to PythonC++11 Python wrapperNumPy C++ integrationlightweight binding library
c++-bindingsextension-modulesperformance

More Python Modules packages