Skip to content

Port from pybind11 to nanobind#34

Draft
wdeconinck wants to merge 2 commits intomasterfrom
nanobind
Draft

Port from pybind11 to nanobind#34
wdeconinck wants to merge 2 commits intomasterfrom
nanobind

Conversation

@wdeconinck
Copy link
Copy Markdown
Collaborator

This PR ports the pybind11 implementation to use nanobind instead.
Unit tests had already been improved with previous PR #32, to catch errors in porting, and are untouched here.

Especially noteworthy here are the new array-view interfaces which nanobind brings more naturally, with support for DLPACK etc.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports the C++/Python bindings from pybind11 to nanobind, updating build configuration and exposing nanobind-backed array/ndarray interfaces (incl. array API / DLPack-related hooks).

Changes:

  • Switch CMake build from pybind11_add_module to nanobind_add_module and update dependency discovery.
  • Replace pybind11 binding code with nanobind equivalents across all exposed Atlas types.
  • Introduce nanobind ndarray-based views for Field (host/device access + NumPy/CuPy/DLPack entry points).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/atlas4py/CMakeLists.txt Updates build to find/link nanobind and build the extension with nanobind_add_module.
src/atlas4py/_atlas4py.cpp Rewrites the binding layer for nanobind and adds ndarray/array interop for fields.
pyproject.toml Switches build-system requirement from pybind11 to nanobind.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/atlas4py/_atlas4py.cpp Outdated
Comment thread src/atlas4py/_atlas4py.cpp
Comment thread src/atlas4py/_atlas4py.cpp
Comment thread src/atlas4py/_atlas4py.cpp
Comment thread src/atlas4py/_atlas4py.cpp Outdated
Comment thread src/atlas4py/_atlas4py.cpp
@wdeconinck wdeconinck marked this pull request as draft April 10, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants