Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce next-generation Python bindings using nanobind #659

Draft
wants to merge 15 commits into
base: devel
Choose a base branch
from

Conversation

ManifoldFR
Copy link
Contributor

@ManifoldFR ManifoldFR commented Feb 17, 2025

This (draft) pull request adds a second set of Python bindings (under the provisional module coal.v2, with extension coal_pywrap_v2) using the modern nanobind bindings generator.

The new nanobind-based API can be imported as a replacement for the old one by importing:

import coal.v2 as coal

Task checklist

  • Ensure no collision with previous set of Boost.Python bindings
  • Stubs
  • Re-expose the following features from the Boost.Python bindings:
    • Version
    • Broadphase (python/broadphase/broadphase.cc)
    • GJK (python/gjk.cc)
    • MeshLoader
    • Maths (python/math.cc)
    • Pickling
    • Serialization
    • Contact patches
    • Distance API (python/distance.cc)
    • Octree (python/octree.cc)
    • Collision (python/collision.cc)
    • Collision Geometries (python/collision-geometries.cc)
      • Base class
      • BVH models
      • Heightfields
      • CollisionObject
  • Test everything

@florent-lamiraux
Copy link
Contributor

For your information, after a quick test based on https://stackoverflow.com/questions/8233252/boostpython-and-weak-ptr-stuff-disappearing, nanobind seems as bad as boost python to handle weak pointers.

@ManifoldFR
Copy link
Contributor Author

ManifoldFR commented Feb 17, 2025

For your information, after a quick test based on https://stackoverflow.com/questions/8233252/boostpython-and-weak-ptr-stuff-disappearing, nanobind seems as bad as boost python to handle weak pointers.

Thanks, this is good to know in the future. Almost certainly, weak pointers will be an object management nightmare whatever the bindings generator is.

Anyhow, there is a definite advantage of upgrading our bindings, namely simplifying maintenance, getting modern features (and up-to-date docs), eliminating the Boost.Python dependency, ability to use the Python 3.12+ stable ABI - which are things Boost.Python simply doesn't have and never will 😃

@ManifoldFR ManifoldFR force-pushed the topic/nanobind branch 2 times, most recently from 250c871 to fca6511 Compare February 17, 2025 20:57
Add more to Transform3s binding
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