Open-source project
RustPython/RustPython avatar
RustPython/RustPython

RustPython: A Python 3 Interpreter Written from Scratch in Rust

A Python Interpreter written in Rust

22,373 stars1,488 forksRustMIT

At a glance

What is it?
RustPython is a Python 3 interpreter implemented in Rust rather than C, targeting CPython 3.14 compatibility. It runs Python code natively, compiles to WebAssembly for browser execution, and can be embedded in Rust applications, but the README is clear that it is not yet production-ready.
Who is it for?
RustPython suits developers who need to embed a Python scripting layer in a Rust application without CPython bindings, or who want to run Python in WebAssembly environments where CPython cannot go. It is not a drop-in CPython replacement for production services: the README explicitly states it is not production-ready, and the JIT compiler is described as very experimental.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What RustPython Is and Why It Exists

RustPython is a Python 3 interpreter written in Rust, targeting CPython 3.14 compatibility. The difference from CPython is not speed or a new runtime model: both interpret Python bytecode. The difference is the implementation language. CPython is written in C; RustPython is written in Rust. This opens two use cases that CPython cannot easily support.

First, Rust applications that want to execute user-written Python scripts can embed RustPython as a Rust library without bridging to a separate CPython process or using C bindings. The README points to examples/hello_embed.rs and examples/mini_repl.rs as starting points for embedding.

Second, Rust compiles to WebAssembly, and RustPython can be compiled to a standalone WASM module. This lets Python code run in a browser or WASI-compatible runtime without requiring a full CPython installation. The README links to an online demo running on WebAssembly. CPython does not have a comparable WebAssembly target.

The goals stated in the README are a full Python 3 environment entirely in Rust without CPython bindings, and a clean implementation without compatibility hacks. Neither goal is fully met yet, but progress toward them is measurable.

Building and Running RustPython from Source

RustPython requires the latest stable Rust. If Rust is not installed, the README directs users to rustup.rs. To check the current version and update:

bash
rustc --version
rustup update stable

Clone the repository:

bash
git clone https://github.com/RustPython/RustPython

The README notes that on Windows, symlinks need explicit enablement:

bash
git config core.symlinks true

Build and run a Python one-liner with release mode (required on Windows to avoid stack overflow):

bash
cargo run --release -- -c 'print("Hello, RustPython!")'

Or launch the interactive shell:

bash
cargo run --release

Alternatively, install the binary directly via cargo:

bash
cargo install --git https://github.com/RustPython/RustPython rustpython
rustpython

Windows users need to set the RUSTPYTHONPATH environment variable to the Lib directory inside the RustPython project directory before the interpreter can find the standard library.

Package Management and venv Support

RustPython implements the venv module to make pip easier to use. Creating a virtual environment:

sh
rustpython -m venv <your_env_name>
. <your_env_name>/bin/activate

After activation, the python command points to RustPython within that environment. The README notes that RustPython does not yet provide a well-packaged installation, so the venv approach helps manage pip in the meantime.

For HTTPS support and pip installation, the ssl feature must be enabled. The README provides a command for installing pip once SSL support is compiled in:

bash
cargo install --git https://github.com/RustPython/RustPython
rustpython --install-pip

On Windows, the README notes that OpenSSL installation may be required, or the ssl-openssl-vendor feature can be used instead, which compiles OpenSSL from source but requires a C compiler, perl, and make. OpenSSL version 3 is expected and tested in CI; older versions may not work.

RustPython is also available through conda-forge, though the README describes this as not officially supported and potentially out of date:

bash
conda install rustpython -c conda-forge

WebAssembly and WASI Compilation

One of the differentiated use cases for RustPython is compiling Python to a WASM WASI module. This allows Python code to run anywhere a WASI-compatible runtime is available, including edge environments and embedded runtimes.

Build the WASI module:

bash
cargo build --target wasm32-wasip1 --no-default-features --features freeze-stdlib,stdlib --release

The freeze-stdlib feature is required to bundle the Python standard library inside the binary, since the WASI module cannot read from the host filesystem by default. Run the module with wasmer:

bash
wasmer run --volume `pwd` -- target/wasm32-wasip1/release/rustpython.wasm `pwd`/extra_tests/snippets/stdlib_random.py

wapm (WebAssembly Package Manager) is also supported:

bash
wapm install rustpython
wapm run rustpython

The online demo linked from the README runs RustPython in a browser using the WebAssembly target. CPython does not have a comparable WASI target; this is one concrete area where RustPython offers something that CPython cannot.

Embedding RustPython in a Rust Application

The README describes embedding RustPython in Rust applications for cases where you want to expose a Python scripting interface in a Rust program without the overhead of a CPython FFI bridge. The examples directory contains hello_embed.rs and mini_repl.rs as working demonstrations.

The Cargo.toml exposes the rustpython crate on crates.io, making it possible to add RustPython as a dependency in a Rust project rather than building from source. The freeze-stdlib feature is relevant for embedded use, as it bundles the standard library into the binary so the host environment does not need a Python installation.

The README mentions GreptimeDB as an example of a project that uses RustPython for embedded scripting in a time-series database written in Rust. pyckitup uses it in a game engine, and Robot Rumble uses it in an arena-based AI competition platform. Ruff, the Python linter written in Rust, is also listed as a user. These concrete use cases show where the embedding path is currently viable.

For Rust-Python interoperability that goes in the other direction (calling Rust from Python, or building Python extension modules in Rust), PyO3 is the established alternative. PyO3 wraps CPython's C API with a Rust interface; RustPython reimplements the interpreter entirely without CPython. They are fundamentally different tools for different scenarios and are not interchangeable.

The Experimental JIT Compiler

RustPython includes a JIT compiler that compiles Python functions to native code, but the README describes it as very experimental. It is not enabled by default and requires enabling the jit cargo feature:

bash
cargo run --features jit

Building with JIT support requires autoconf, automake, libtool, and clang to be installed. Once compiled, a Python function is JIT-compiled by calling `__jit__()` on it:

python
def foo():
    a = 5
    return 10 + a

foo.__jit__()
assert foo() == 15

The function is compiled to native code on the first call to `__jit__()`, and subsequent calls execute that native code. The README does not give any performance numbers for the JIT compiler, and the very experimental label means the scope of supported Python constructs is limited. Teams should not plan around the JIT as a performance optimization path at this stage of development.

Current Limitations and CPython Compatibility Gap

The README states directly: RustPython is not totally production-ready. This is not a disclaimer hedge. It means that some standard library modules are not yet implemented, that C extension modules cannot be loaded (since RustPython does not use CPython's C API), and that edge cases in the Python language specification may produce different behavior than CPython.

C extension modules are a significant practical limitation. A large portion of the scientific Python ecosystem (NumPy, pandas, SciPy, and their dependents) is implemented as C extensions. These modules cannot load or run on RustPython, which cuts off a major category of Python use cases entirely. The README does not document which standard library modules are complete and which are partial or missing; checking the test suite or the issue tracker is the reliable way to know.

The target is CPython >= 3.14.0, which is a current and recent version of Python. This means RustPython is tracking the current language version rather than a historical one, but the compatibility work is ongoing. Teams evaluating RustPython for embedding should test their specific Python scripts against RustPython directly before committing to it, since the gap between documented goals and current behavior can be large for anything beyond basic arithmetic and simple stdlib use.

Editorial conclusion

RustPython suits developers who need to embed a Python scripting layer in a Rust application without CPython bindings, or who want to run Python in WebAssembly environments where CPython cannot go. It is not a drop-in CPython replacement for production services: the README explicitly states it is not production-ready, and the JIT compiler is described as very experimental. Teams using it should verify which standard library modules are available for their use case, since CPython compatibility is a goal rather than a current guarantee across all modules. The MIT license imposes no restriction on use. The last push was 2026-09-27.

Frequently asked questions

What is RustPython?

RustPython is a Python 3 interpreter written in Rust, targeting CPython 3.14 compatibility. It can run Python code natively, compile to WebAssembly for browser or WASI environments, and be embedded in Rust applications without using CPython's C API.

How do I install RustPython?

Clone the repository with git clone https://github.com/RustPython/RustPython and build with cargo run --release. Alternatively, install the binary directly with cargo install --git https://github.com/RustPython/RustPython rustpython. Rust stable must be installed first.

How does RustPython compare to CPython in performance?

The README does not provide benchmark numbers comparing RustPython to CPython. The interpreter is not yet production-ready, and performance optimization is not the primary goal at this stage. RustPython's value is in WebAssembly support and Rust embedding, not outpacing CPython's execution speed.

What is the difference between RustPython and PyO3?

RustPython reimplements the Python interpreter from scratch in Rust, so Python code runs inside RustPython without CPython. PyO3 wraps CPython's C API with Rust bindings, so Rust code can call into a running CPython instance or write Python extension modules in Rust. They solve different problems.

Is Rust replacing Python?

RustPython's stated goal is to implement a full Python 3 environment in Rust, not to replace Python. The two languages target different problems: Rust for systems programming with compile-time safety guarantees, Python for scripting, data science, and rapid development. RustPython's use cases are embedding Python in Rust applications and running Python in WebAssembly, not superseding CPython.

Official sources

  1. Issues
  2. License: MIT
  3. Project website
  4. README
  5. RustPython/RustPython on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/rustpython-rustpython.svg)](https://hysenlabs.com/projects/rustpython-rustpython)