We (@emmatyping, @eclips4) propose introducing the Rust programming language to CPython. Rust will initially only be allowed for writing optional extension modules, but eventually will become a required dependency of CPython and allowed to be used throughout the CPython code base.
As much as I like Rust, Python is a very early dependency in the bootstrap path for most Linux distributions (it’s a build-time dependency of glibc and gcc). With this change Rust becomes necessary to build most Linux distros, and it does not support all the architectures that Linux does. There is of course the Rust-for-Linux project aiming to bring Rust to the Linux kernel, but that is currently optional and is taking a conservative incremental approach for integrating it.
Rust supports all platforms which CPython supports and many more as well. Rust’s tiers are slightly different, and include information on whether host tools (such as
rustcandcargo) are provided. Here are all of the PEP 11 platforms and their corresponding tiers for Rust:
In summary, every platform Python supports is supported [by] Rust at tier 2 or higher, and host tools are provided for every platform other than those where Python is already cross-compiled (e.g. WASI and mobile platforms).
I’m surprised how small the officially supported platform list is for Python. It’s certainly used on a much more diverse set of architectures than the official list. For example, there’s not a single musl based distro on the list. Gotta imagine there’s a lot of Alpine containers out there running Python code. Also of the BSDs only FreeBSD is listed.
Making Rust a dependency of CPython would introduce a bootstrapping problem: Rust depends on Python to bootstrap its compiler.
Rust already has a pretty sorry bootstrapping story, unfortunately this only makes it worse. There’s hope that gcc-rs comes to the rescue of bootstrapping quandaries like this as well as architecture support, but it doesn’t look to be getting anywhere near the resources it needs. For the health of the Rust project, and to make it less dramatic to introduce a dependency on Rust to established projects the Foundation could be funding gcc-rs more significantly.

