nanobind  by wjakob

Tiny and efficient C++/Python bindings library

Created 3 years ago
3,247 stars

Top 14.8% on SourcePulse

GitHubView on GitHub
Project Summary

<2-3 sentences summarising what the project addresses and solves, the target audience, and the benefit.> nanobind is a C++/Python binding library designed for maximum efficiency, targeting developers who need to expose C++ types in Python and vice-versa. It offers significant improvements over established tools like pybind11 and Cython in compile times, binary size, and runtime performance, enabling leaner and faster Python extensions.

How It Works

This library provides a C++ API for creating Python bindings, aiming for a syntax similar to pybind11. Its core advantage lies in its optimized implementation, which yields faster compilation, smaller executable sizes, and reduced runtime overhead compared to alternatives. This efficiency is achieved through careful design choices that streamline the binding process and C++/Python interaction.

Quick Start & Requirements

Installation details are not explicitly provided in the README, but comprehensive tutorial and reference documentation are available. Key features include support for the Python Stable ABI, particularly beneficial from Python 3.12 onwards, which can simplify deployment by reducing the need for per-Python version specific builds.

Highlighted Details

  • Benchmarks show up to ~4x faster compile times, ~5x smaller binaries, and ~10x lower runtime overheads compared to pybind11.
  • Outperforms Cython with 3-12x binary size reduction and 1.6-4x compilation time reduction, while maintaining similar runtime performance.
  • Supports Python Stable ABI (from Python 3.12), simplifying distribution by avoiding per-Python version CUDA plugins.
  • Adopted by major projects including IREE, XLA/MLIR, Apple MLX, JAX, FEniCS/DOLFINx, and PennyLane.

Maintenance & Community

The project is authored by Wenzel Jakob. Its adoption by prominent open-source projects indicates active real-world usage and potential for ongoing maintenance. No specific community channels (e.g., Discord, Slack) or detailed roadmap are mentioned in the README.

Licensing & Compatibility

Licensed under a permissive three-clause BSD license. This license generally allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The README does not explicitly detail limitations. Its focus on Python 3.12 for Stable ABI support might imply less streamlined integration with older Python versions for certain deployment scenarios.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
10
Issues (30d)
3
Star History
56 stars in the last 30 days

Explore Similar Projects

Starred by Matthijs Douze Matthijs Douze(Coauthor of Faiss; Research Scientist at Meta) and Xiaofan Luan Xiaofan Luan(VP Engineering at Zilliz).

knowhere by zilliztech

0.3%
310
Vector search engine for Milvus
Created 2 years ago
Updated 2 days ago
Feedback? Help us improve.