Repository navigation
Seam: step from Python into PyO3 Rust code in VS Code #6495
ChirayuAgg0706
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I built Seam, an open-source debugger for Python programs that call native extensions. For a PyO3 extension, you can stop on the Python call, use Step Into to enter Rust, inspect its locals, and Step Out back to Python. The call stack shows both languages in one VS Code session.
Here's a small example: a Python checkout test applies a 10% discount to $100, but gets $10 instead of $90. Stepping into Rust shows that the function returns the discount amount. The recording follows the one-line fix, rebuild and passing test. It's a deliberately broken teaching example, recorded with the released extension.
Run the example yourself. The walkthrough includes installation, source code, the fix, and a downloadable 44-second video. Pauses are cut from the recording; it isn't a startup-speed benchmark.
Underneath, LLDB controls the process. A small helper uses CPython's monitoring API for Python breakpoints and stepping. While paused in Rust, you can select a Python caller and inspect simple values from memory. Evaluating Python expressions requires returning to a Python stop.
You'll need CPython 3.12-3.14 with the GIL enabled, LLDB, and your extension built with debug information. Seam supports Linux x86-64 and Apple Silicon macOS 14+. On Windows, use WSL. Child processes run but aren't debugged. On macOS, automatic Step Into excludes modules with more than 20,000 functions; source and function breakpoints still work. See the full requirements and limits.
Install from the VS Code Marketplace. The extension includes Seam, so no separate pip installation is needed. Source code is Apache-2.0 licensed.
If you work on a PyO3/maturin extension, try it on one call in your own project. Tell me what you wanted to inspect and whether you got there. Setup failures are useful feedback too.
All reactions