Migrate pybind11 to nanobind#1089
Conversation
* Migrate Python bindings to nanobind and align abi3 packaging - replace pybind11 with nanobind v2.13.0 in CMake and dependency manifest - port pyop bindings and C API wrappers from pybind11 APIs to nanobind APIs - update wheel build matrices to build cp310/cp311/cp312 only for abi3 strategy - add py_limited_api metadata and wheel tagging for cp312+ stable ABI - add abi3audit checks (cp312 baseline) in cibuildwheel test scripts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Align limited ABI gating with ONNX strategy - enable py_limited_api only on CPython >= 3.12 and non-free-threaded runtimes - define Py_LIMITED_API=0x030C0000 only when limited ABI is enabled - gate bdist_wheel cp312 abi3 tagging with the same runtime checks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot please fix: |
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s Python extension module from pybind11 to nanobind and adjusts packaging/CI to support an abi3-oriented wheel strategy (cp310–cp312) with additional verification for stable-ABI compliance.
Changes:
- Port C++ binding code from pybind11 to nanobind for the
_extensions_pydllmodule (including the optional C API wrapper). - Update CMake external dependency wiring from pybind11 to nanobind and build the Python module via
nanobind_add_module. - Adjust wheel build matrices to drop cp313 and add runtime checks (including abi3audit on Python ≥ 3.12).
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/test_cibuildwheel.sh | Adds import smoke test and runs abi3audit on Python ≥ 3.12. |
| tools/test_cibuildwheel.bat | Windows equivalent of the import smoke test + abi3audit gating. |
| tools/ci_build/github/azure-pipeline/wheels_macos.yml | Narrows cibuildwheel build targets to cp310–cp312. |
| tools/ci_build/github/azure-pipeline/wheels_linux.yml | Narrows cibuildwheel build targets to cp310–cp312 (x86_64 + aarch64). |
| tools/ci_build/github/azure-pipeline/templates/windows-build-stage.yml | Narrows Windows cibuildwheel build targets to cp310–cp312. |
| setup.py | Adds limited-API metadata/macros (gated) and sets python_requires>=3.10. |
| pyop/pykernel.h | Updates C-API module signature to nanobind and forward-declares nanobind::module_. |
| pyop/pyfunc.cc | Migrates main binding module to nanobind; refactors numpy/tensor conversions and invocation plumbing. |
| pyop/py_c_api.cc | Migrates C API Python wrapper bindings to nanobind; refactors numpy conversion. |
| cmake/externals/pybind11.cmake | Removes pybind11 FetchContent integration. |
| cmake/externals/nanobind.cmake | Adds nanobind FetchContent integration (v2.13.0). |
| cmake/ext_python.cmake | Switches to find_package(Python ...) + nanobind_add_module (stable ABI). |
| cgmanifest.json | Replaces pybind11 component entry with nanobind (v2.13.0). |
| .pyproject/cmdclass.py | Adds bdist_wheel customization to tag cp312 abi3 wheels when applicable. |
| .pipelines/wheels_win32.yml | Narrows pipeline wheel targets to cp310–cp312. |
| .pipelines/wheels_macos.yml | Narrows pipeline wheel targets to cp310–cp312. |
| .pipelines/wheels_linux.yml | Narrows pipeline wheel targets to cp310–cp312 (x86_64 + aarch64). |
| .pipelines/templates/onebranch-windows-build-stage.yml | Narrows OneBranch Windows wheel targets to cp310–cp312. |
| .github/workflows/linux_arm64_wheel.yaml | Updates GH Actions arm64 wheel matrix to Python 3.10–3.12. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
... Fixed in 25d7636. I exported |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot find all python 3.8 CI envs and update them to 3.10 |
Updated the remaining Python 3.8 CI environment to Python 3.10 in |
|
@copilot for some reason I still get |
It was the image content, not the |
Migrate Python bindings to nanobind and align abi3 packaging