Skip to content

feat: allow opt-in for new backends - #409

Draft
b-long wants to merge 27 commits into
masterfrom
feature/replacing-pybindgen
Draft

b-long wants to merge 27 commits into
masterfrom
feature/replacing-pybindgen

Conversation

@b-long

@b-long b-long commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

⚠️ work-in-progress ⚠️

Relates-to: #408

Adds opt-in alternatives to pybindgen, chosen with GOPY_BACKEND. The default stays pybindgen, so nothing changes unless you opt in.

Backend Needs Status
cffi cffi full suite passes
pybind11 pybind11, C++ compiler full suite passes
nanobind nanobind, C++ compiler full suite passes
capi nothing beyond Python full suite passes
cgo — not started

Each backend has its own CI job on Linux, macOS and Windows (Python 3.11 and 3.12), with pybindgen not installed. A benchmark job compares per-call time and memory across all backends.

Notes

  • capi keeps the default backend's Go shim and build, but writes the C module itself instead of calling pybindgen. Its output matches pybindgen's argument handling and errors. It's
    the simplest way to drop the pybindgen dependency.
  • cffi, pybind11 and nanobind share a Go shim that avoids the CPython C API. The Python side is either a cffi module or a compiled C++ module.
  • TestMakefile is still skipped for pybindgen and capi. Their shared Makefile links against a separate Go library that isn't found at import time. This problem predates this PR.

To do

  • Decide what cgo should mean, or drop it (it overlaps with capi)
  • Fix the pybindgen/capi Makefile, then stop skipping TestMakefile for them

@b-long b-long mentioned this pull request Sep 19, 2026
Comment thread main_test.go Outdated
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.

1 participant