Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Establishes migration path from 994 lines of custom C extension generator to nanobind. Research shows nanobind (by pybind11's author) delivers 4-10× performance gains, 5× smaller binaries, and zero-copy NumPy integration—critical for real-time audio DSP.

Changes

Research & Decision (PYTHON_BINDINGS_MIGRATION_GUIDE.md, PYTHON_BINDINGS_SUMMARY.md)

  • nanobind selected over pybind11: Superior performance (10× lower overhead), smaller binaries, modern C++17, excellent NumPy integration
  • Complete 5-phase migration plan (14-20 days): Infrastructure → PoC → Core Types → Objects → Validation
  • Detailed implementation steps with C++ wrapper patterns, nanobind binding examples, test strategies

Phase 1: Build Infrastructure

  • vcpkg.json: Added nanobind dependency
  • meson_options.txt: New nanobind feature flag (auto-detect)
  • python/nanobind_bindings/: New directory with meson.build, C++ wrapper template, module docs
  • python/tests/test_nanobind.py: Test framework (10 test stubs)
  • Graceful fallback when nanobind unavailable—coexists with existing C extension

Migration Strategy

# Current: Custom generator parses aubio.h → generates C extension
gen_external.py + gen_code.py (994 lines) → gen-onset.c, gen-pitch.c, etc.

# Target: Modern C++ bindings with nanobind
aubio_cpp::Onset wrappernanobind bindingsPython with type hints

Incremental migration preserves API compatibility. Both binding systems coexist until Phase 5.

Next: Phase 2 (Proof of Concept)

Implement fvec/cvec bindings to validate approach and benchmark performance claims.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.fftw.org
    • Triggering command: curl --fail --retry 3 -L REDACTED --create-dirs --output fftw-3.3.10.tar.gz.3939.part -H User-Agent: vcpkg/2025-10-16-71538f2694db93da4668782d094768ba74c45991 (curl) (dns block)
    • Triggering command: curl --fail --retry 3 -L REDACTED --create-dirs --output fftw-3.3.10.tar.gz.4540.part -H User-Agent: vcpkg/2025-10-16-71538f2694db93da4668782d094768ba74c45991 (curl) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

review the optimisation priorities and begin working on modernisation of the python bindings.

I want to use either pybind11 or nanobind - establish which is the best option using the latest information available on the internet.

begin this piece of work by collecting and documenting all essential steps and stages into a python bindings migration guide, and then begin implementing once the steps and guides are fully completed


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Review optimisation priorities for python bindings modernisation Python bindings modernization: nanobind migration plan and Phase 1 infrastructure Nov 14, 2025
Copilot AI requested a review from shauneccles November 14, 2025 13:26
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