Repository navigation
Modernize the Python native binding workshop and add Rust - #2
Merged
Merged
Conversation
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.
What changed
The workshop now builds seven native Fibonacci implementations and a Python reference in one locked uv workspace. CFFI still loads a shared C library, Cython shows both wrapping C and compiling a typed loop, and SWIG exposes C functions and a struct. pybind11 and nanobind wrap the same C++ function. PyO3 and maturin add a Rust extension. The benchmark checks the answers before timing each implementation.
Four runnable labs cover numerical integration, byte buffers, STL vectors, and callbacks into Python. The buffer and vector examples now use zlib with explicit output sizes. The original slides and handout are preserved with a link to the corresponding historical checkout.
Try it locally
Install uv, the C/C++ and Rust toolchains, and zlib development headers, then run:
make test make benchmark make check make docs-testThe guide includes direct uv commands for Windows. CI runs the shared tests and a benchmark smoke test on CPython 3.11 through 3.15 on Linux, plus 3.15 on macOS and Windows. The documentation workflow uploads the rendered site for review and publishes to GitHub Pages after merge to main.