Hacker News
Libraries Run Rust Inside Python (With PyO3)
The article demonstrates building a Rust-based JSON parser and exposing it to Python via PyO3 and maturin, showing the four steps required: writing Rust code, annotating with #[pyfunction] and #[pymodule] macros, compiling to a shared library, and importing it in Python. It explains that the parser returns a Rust enum representing the JSON tree, and the costly conversion to native Python objects occurs when .into_pyobject traverses the entire structure, often outweighing the parsing time itself.