nanobind is a small binding library that exposes C++ types in Python and vice versa. It is reminiscent of Boost.Python and pybind11 and uses near-identical syntax. In contrast to these existing tools, nanobind is more efficient: bindings compile in a shorter amount of time, produce smaller binaries, and have better runtime performance.
More concretely, benchmarks <benchmarks>
show ~2-3× faster compile time, ~3× smaller binaries, and up to ~8× lower runtime overheads compared to pybind11.
not latex
You are reading the HTML version of the documentation. An alternative PDF version is also available.
latex
Dependencies
nanobinds depends on
- Python 3.8+ or PyPy 7.3.10+ (the 3.8 and 3.9 PyPy flavors are supported, though there are
some limitations <pypy_issues>
). - CMake 3.15+.
- A C++17 compiler: Clang 7+, GCC 8+, and MSVC2019+ are officially supported. Others (MinGW, Intel, NVIDIA, ..) may work as well but will not receive support.
latex
How to cite this project?
Please use the following BibTeX template to cite nanobind in scientific discourse:
@misc{nanobind,
author = {Wenzel Jakob},
year = {2022},
note = {https://github.com/wjakob/nanobind},
title = {nanobind---Seamless operability between C++17 and Python}
}
The nanobind logo was designed by AndoTwin Studio. High-resolution version are available here (light) and here (dark).
changelog why benchmark porting faq
installing building basics
exchanging ownership functions classes exceptions ndarray_index packaging
ownership_adv lowlevel typeslots
api_core api_extra api_cmake