nanobind
nanobind: tiny and efficient C++/Python bindings
What it is and what it does
nanobind is a C++/Python binding library designed to expose C++ types and functions in Python with minimal overhead. It follows syntax similar to Boost.Python and pybind11, making it familiar to developers who have used those tools. The core value proposition is efficiency: the description reports faster compilation times, smaller compiled binaries, and lower runtime performance penalties compared to pybind11 and Cython.
You use nanobind when you need to call C++ code from Python or wrap C++ libraries for Python consumption. It is a build-time tool—you write binding code that nanobind processes to generate Python-callable wrappers around your C++ components. The package itself installs without friction as a pre-built wheel, though actually using it requires a C++ compiler and build environment to compile your bindings.
Use it for:
- Wrap existing C++ libraries to make them callable from Python without rewriting them
- Build high-performance Python extensions in C++ where pure Python is too slow
- Create Python bindings for scientific or numerical C++ code with minimal runtime overhead
- Integrate C++ game engines, graphics libraries, or real-time systems with Python applications
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
nanobind exposes C++ types in Python and vice versa, enabling efficient C++/Python bindings with faster compilation, smaller binaries, and lower runtime overhead than comparable tools.
Yes, if you need to bind C++ code to Python. The package is actively maintained, has no known vulnerabilities, installs with low friction, and offers a permissive license. The efficiency claims relative to pybind11 are significant enough to justify trying it for performance-critical bindings, though you should verify those claims match your specific use case.
Install
nanobind on PyPI
pip
pip install nanobinduv
uv add nanobindpoetry
poetry add nanobindInstalling nanobind
Before you install
Low friction: ships as a pre-built wheel. Actively maintained with a release 7 days ago and 3668 repository stars.
License in practice
Permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install nanobind==2.14.0
import nanobind as nb
# Use nanobind to wrap C++ code in Python bindings
Requires a C++ compiler and build toolchain to compile C++ code being wrapped; the wheel itself installs without compilation.
Verify before relying
- Exact performance multipliers (4×, 5×, 10×) claimed in description against pybind11 and Cython—whether these hold across typical use cases
- Whether nanobind supports all C++ standards and features that pybind11 or Cython cover, or if there are known gaps
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,225,726/month — #2,358 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nanobind-2.14.0-py3-none-any.whl
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
ccimportccimport builds Python C++ bindings on-the-fly…
permissive · top 15,000 on PyPI
pybind11pybind11 is a header-only C++ library that…
permissive · top 1,000 on PyPI
pybind11-globalA header-only C++ library that generates Python…
permissive · top 15,000 on PyPI
zxing-cppReads and writes barcodes and QR codes in…
permissive · top 5,000 on PyPI
pccmPCCM manages Python-to-C++ code generation and…
permissive · top 15,000 on PyPI
p4pythonp4python wraps the Perforce C++ API to provide…
unclear · top 15,000 on PyPI
fast-simplificationSimplifies 3D meshes by reducing the number of…
permissive · top 15,000 on PyPI
cwrapcwrap is a Python wrapper around C code that…
copyleft · top 15,000 on PyPI