Home

Awesome

nanobind_example

CIstatus
pip buildsPip Action Status
wheelsWheel Action Status

This repository contains a tiny project showing how to create C++ bindings using nanobind and scikit-build-core. It was derived from the corresponding pybind11 example project developed by @henryiii.

Furthermore, the bazel branch contains an example on how to build nanobind bindings extensions with Bazel using the nanobind-bazel project.

Installation

  1. Clone this repository
  2. Run pip install ./nanobind_example

Afterwards, you should be able to issue the following commands (shown in an interactive Python session):

>>> import nanobind_example
>>> nanobind_example.add(1, 2)
3

CI Examples

The .github/workflows directory contains two continuous integration workflows for GitHub Actions. The first one (pip) runs automatically after each commit and ensures that packages can be built successfully and that tests pass.

The wheels workflow uses cibuildwheel to automatically produce binary wheels for a large variety of platforms. If a pypi_password token is provided using GitHub Action's secrets feature, this workflow can even automatically upload packages on PyPI.

License

nanobind and this example repository are both provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.