Repository navigation
Conversation
b-long
commented
Oct 4, 2026
b-long
commented
Oct 24, 2026
This comment was marked as outdated.
This comment was marked as outdated.
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. The only change to its output is the generated Makefile fix described below.gopy execapicfficffipybind11pybind11, C++ compilernanobindnanobind, C++ compilerEach 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 and uploads the table as a build artifact.
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's the simplest way to drop the pybindgen dependency.cffi,pybind11andnanobindshare a plain-C Go shim that avoids the CPython C API. The Python side is either a cffi module or a compiled C++ module. Because of that shim:gopy exerejects them up front, since exe mode embeds the interpreter through the C API.PyObject*, such as a callback type the shim can't translate or complex numbers outside the supported cases. gopy printsignoring function not supported by GOPY_BACKEND=<name>: ...for each one.gopy genwrites forpybindgen(andcapi) used to link_<pkg>against a separate<pkg>_golibrary with no rpath, so the result didn't import as-is. It now has cgo compile<pkg>.cinto one shared library, the same waygopy builddoes.TestMakefilenow runs for every backend.gopy pkgandgopy exenow restore the working directory when they finish._examples/callbacks, additions to_examples/pyerrorsand_examples/slices, plus Go unit tests inbind/for backend selection, callbacks and the C++ build.