Conversation
b-long
commented
Oct 4, 2026
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.
Relates-to: #408
Adds opt-in alternatives to pybindgen, chosen with
GOPY_BACKEND. The default stayspybindgen, so nothing changes unless you opt in.cfficffipybind11pybind11, C++ compilernanobindnanobind, C++ compilercapicgoEach 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
capikeeps 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'sthe simplest way to drop the pybindgen dependency.
cffi,pybind11andnanobindshare a Go shim that avoids the CPython C API. The Python side is either a cffi module or a compiled C++ module.TestMakefileis still skipped forpybindgenandcapi. Their shared Makefile links against a separate Go library that isn't found at import time. This problem predates this PR.To do
cgoshould mean, or drop it (it overlaps withcapi)pybindgen/capiMakefile, then stop skippingTestMakefilefor them