RustPython

An open source Python 3 (CPython >= 3.11.0) interpreter written in Rust 🐍 😱 🀘

Python Logo Python
↓
RustPython
β†’
Python embedded in Rust apps
↓
WebAssembly Logo WebAssembly
β†’
Python on the Web

RustPython is a Python interpreter written in Rust. RustPython can be embedded into Rust programs to use Python as a scripting language for your application, or it can be compiled to WebAssembly in order to run Python in the browser. RustPython is free and open-source under the MIT license.

Installation
cargo install --git https://github.com/RustPython/RustPython rustpython wapm install rustpython conda install rustpython -c conda-forge
Goals
Full Python 3 environment entirely in Rust (not CPython bindings), with a clean implementation and no compatiblity hacks.
Fast, reliable and secure implementation of Python that can be used from Rust or compiled to WebAssembly.

Why RustPython?

There are many implementations of Python. For example:

Each of these implementations offer some benefits: Jython, for example, compiles Python 2 source code to Java byte code, then routes it to the Java Virtual Machine. Because Python code is translated to Java bytecode, it looks and feels like a true Java program at runtime and so it integrates well with Java applications.

IronPython is well-integrated with .NET, which means IronPython can use the .NET framework and Python 2 libraries or vice versa.

We want to unlock the same possibilities that Jython and IronPython enable, but for the Rust programming language. In addition, thanks to Rusts’ minimal runtime, we’re able to compile RustPython to WebAssembly and allow users to run their Python code easily in the browser.