Pre-PEP: Rust for CPython Proposed

LinkEmma SmithDiscussion

A proposal on the Python discussion forum suggests introducing the Rust programming language into CPython. Initially planned for optional extension modules, Rust is envisioned to eventually become a required dependency across the CPython codebase.

Key points

  1. The primary goals are enhanced memory safety and thread safety, especially critical for free-threaded Python builds.
  2. A new crate, cpython-sys, would supply Rust FFI definitions generated automatically from C headers via bindgen.
  3. PyO3 was rejected as a direct dependency to avoid development overhead when updating the CPython C API.
  4. Every platform listed under PEP 11 is currently supported by Rust at Tier 2 or higher.
  5. A proposed timeline suggests configure warnings in Python 3.15, transitioning towards requiring Rust by Python 3.17.
  6. Open challenges include handling circular bootstrapping issues, as the Rust compiler currently relies on Python to build.

Why it matters

CPython's reliance on C has historically exposed it to memory corruption bugs. Bringing Rust into the standard library and runtime eliminates whole classes of vulnerabilities and data races, mirroring wider industry moves seen in projects like Linux and Android.

Analysis

While adopting Rust provides clear benefits in performance and thread safety, the transition involves serious supply chain and ecosystem considerations. Managing dependencies with Cargo, avoiding circular bootstrap loops, and supporting legacy platforms lacking LLVM backends will remain the central talking points before any formal PEP approval.

Found in

Summary generated by AI (Gemini 3.8 Flash, 27 September 2026). It may contain errors – the original source is authoritative.

Similar in content, found by the AI search.

  • Link:Emma Smith

    Rust for CPython: Making Python Safer and More Robust

    A PyCon US 2026 presentation covers the Rust for CPython initiative, which explores integrating Rust into CPython to replace legacy C code, targeting memory and thread unsafety.

    Security· Talk

  • Article:Daroc Alden

    Rust in CPython: Debate Sparked Over Gradual Integration

    Python core developers Emma Smith and Kirill Podoprigora have proposed introducing Rust into CPython. Following community concerns regarding platform support and maintenance overhead, the timeline to make Rust a mandatory dependency has been postponed indefinitely.

    Web development· Discussion

  • Repository:emmett-framework/granian

    Granian: A Rust HTTP Server for Python Applications

    Granian is a high-performance HTTP server for Python applications built in Rust using Hyper and Tokio. It supports ASGI, WSGI, and RSGI interfaces, aiming to replace complex dependency stacks like Gunicorn plus Uvicorn with a single, fast binary package.

    5.6kstarsRust

    Web development· Tool

  • Article:mojolang.org

    Python Interoperability in Mojo 1.0.0

    The official documentation for Mojo version 1.0.0 details its two-way interoperability with the Python ecosystem. Mojo supports importing existing Python modules via CPython and calling Mojo functions from Python through bindings without extra compilation steps.

    AI & LLMs· Resource

  • Link:Michael Kennedy

    Running Python on Rust: Granian as a Production App Server

    In Chapter 6 of his book 'Python in Production', Michael Kennedy explains the deployment of Granian as an HTTP server for Python applications. Built with Rust, Granian replaces legacy tools like uWSGI, excelling in benchmarks through consistent low tail latency and dual support for WSGI and ASGI.

    Web development· Resource

  • Article:Yuchen Wu and Andrew Hauck

    Cloudflare Unveils Pingora: Rust-Based HTTP Proxy Replacing NGINX

    Cloudflare has developed Pingora, an in-house HTTP proxy written in Rust that replaces its previous NGINX infrastructure. The system serves over one trillion requests per day while using only one-third of the CPU and memory resources of the legacy stack.

    Web development· Announcement

Let's talk about your project

Locations

  • Mattersburg
    Johann Nepomuk Bergerstraße 7/2/14
    7210 Mattersburg, Austria
  • Vienna
    Ungargasse 64-66/3/404
    1030 Wien, Austria

Parts of this content were created with the assistance of AI.