Emma Smith (Emma Smith) and Kirill Podoprigora (Kirill Podoprigora), who are among the core Python developers (core team), have recently published a Pre-PEP aimed at gradually integrating Rust capabilities into the CPython codebase, which is the reference implementation of the Python programming language. The proposal suggests initially using Rust for optional modules of the standard library found in the Modules/ directory. Eventually, Rust could potentially become a mandatory dependency by the release of Python 3.17.
The introduction of Rust into the CPython codebase is primarily driven by the need to ensure safe memory management, prevent common errors like use-after-free and buffer overruns, and simplify the development of thread-safe code especially with the official support for CPython builds without Global Interpreter Lock (GIL) to parallelize operations on multi-core systems. Rust also offers high-level data structures and a robust metaprogramming system, including hygienic macros.
The implementation roadmap laid out in the proposal includes the following milestones:
- Python 3.15 (2026): Warning if Rust is not present in the build environment.
- Python 3.16 (2027): Ability to build without Rust using the “–with-rust=no” flag.
- Python 3.17 (2028): Rust may become a mandatory requirement at build time.
To interface with the CPython C API, the plan is to utilize auto-generated bindings through bindgen instead of relying on third-party abstractions like PyO3, in order to avoid delays in updating the API. Discussions are ongoing regarding dependency management, cross-compilation, and support for uncommon platforms.
The proposal underlines that Rust supports all platforms outlined in PEP 11 at least at the Tier