Rust bindings for the Python interpreter, enabling Rust code to call Python and Python to call Rust.
rust-cpython is a Rust library that provides bindings for the Python interpreter, enabling seamless interoperability between Rust and Python code. It allows developers to write Python extension modules in Rust or embed Python within Rust applications, though the project is no longer actively maintained and users are encouraged to switch to PyO3.
Rust developers who need to integrate Python code into their applications, such as those building Python-compatible native modules or embedding Python interpreters in Rust projects.
Developers choose rust-cpython for its safe and ergonomic interface that leverages Rust's ownership model to manage Python's global interpreter lock and memory safely, with support for Python 2.7 and Python 3.7 through 3.12.
Rust <-> Python bindings
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports Python 2.7 and Python 3.7 through 3.12, as stated in the README, enabling compatibility with both legacy and modern Python codebases.
Leverages Rust's ownership model to safely handle Python's Global Interpreter Lock, preventing concurrency issues in mixed-language code, as emphasized in the philosophy.
Uses macros like py_fn! to automatically convert between Python objects and Rust values, simplifying interface code, as shown in the example library.
Built-in support for creating Python-compatible native modules (.so, .pyd, .dylib) with clear examples in the README for building and integration.
The README explicitly warns it's no longer actively maintained and recommends switching to PyO3, making it risky for long-term use or new projects.
Building on macOS requires additional linker arguments and configuration in a .cargo/config file, adding platform-specific complexity not needed on other OSes.
With the project deprecated, documentation may be outdated, and there's less community support or resources compared to active alternatives like PyO3.