[WIP] unify pybind11 and nanobind into single-source bindings#5254
Draft
soswow wants to merge 3 commits into
Draft
[WIP] unify pybind11 and nanobind into single-source bindings#5254soswow wants to merge 3 commits into
soswow wants to merge 3 commits into
Conversation
Remove the parallel src/python-nanobind/ tree and compile one set of binding sources per build, selected by OIIO_PYTHON_BINDINGS_BACKEND (pybind11 or nanobind; drop the "both" mode). Add py_backend.h with namespace py = pybind11|nanobind and small oiio_py:: helpers/macros only where the APIs differ. Migrate roi, typedesc, imagespec, and paramvalue to dual-backend declare_* sources; fold the former py_oiio_nb helpers and partial module init into py_oiio.h / py_oiio.cpp behind #if OIIO_PY_BACKEND_NANOBIND. Install nanobind modules into the same site-packages/OpenImageIO tree as pybind11 (no separate nanobind package or duplicate tests). Update CMake, CI, and INSTALL.md accordingly; move MIGRATION_STATUS.md into src/python/. Materialize string_view returns as std::string in py_imagespec.cpp so nanobind can convert them to Python str. Assisted-by: Cursor / Auto Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
8f988a1 to
4dbfbc5
Compare
…nanobind Refactor CMake configuration to support both pybind11 and nanobind backends through a single option, OIIO_PYTHON_BINDINGS_BACKEND, allowing for flexible builds. Update CMakeLists.txt to conditionally include source directories based on the selected backend. Modify INSTALL.md to clarify usage instructions for enabling either backend or both. Adjust CI workflows to build with the 'both' option, ensuring compatibility with both binding systems. Update various source files to streamline the integration of nanobind and pybind11, including changes to installation paths and test configurations. Assisted-by: Cursor / Auto Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
4dbfbc5 to
2f5a354
Compare
Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
907a05f to
b388996
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
exploring an idea Anton had about unifiying two python backends into single source since they are so similar.
Not yet ready for review.