Skip to content

RustPython

A Python 3 interpreter written in Rust, aiming for full Python 3 compatibility.

Stars
22.5k
Forks
1.5k
Licence
MIT
Language
Rust
Last update
4 days ago
Type
Other

What it is

RustPython is an implementation of the Python programming language, written in Rust rather than C like the standard CPython interpreter. You can use it to run Python scripts or an interactive Python shell. Its README says it is still in development and not fully production-ready, but it can run in a browser via WebAssembly and can be embedded into Rust applications.

  • Run a Python snippet from the command line with cargo run --release -- -c
  • Use the interactive shell to try Python code
  • Compile RustPython to a WASI WebAssembly module and run it with a runtime such as wasmer
  • Embed Python scripting into a Rust application, using the examples in the repository as a starting point

Great for

  • Developers who want to experiment with a Python interpreter written in Rust
  • Rust developers who want to embed Python scripting in their applications
  • People interested in running Python in WebAssembly or WASI environments
  • Contributors interested in interpreter internals

Not ideal for

  • Production workloads, because the README says RustPython is not totally production-ready
  • Users who need a fully packaged Python with reliable pip and venv support, because the README says it lacks a well-packaged installation
  • Projects relying on CPython-specific C extensions, since the README describes the goal as a pure Rust Python environment, not CPython bindings
Step-by-step guide: how to use RustPythonInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Rust latest stable toolchain (via rustup.rs) · Git

    Clone the source code

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

    Change into the project directory

    cd RustPython

    Run a quick Python command

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

    Install the rustpython binary from git

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

    Run it

    • Install Rust with rustup if you do not have it.
    • Clone the repository and change into the RustPython directory.
    • Run cargo run --release -- -c 'print("Hello, RustPython!")' to confirm it works.
    • Run cargo run --release with no arguments to open the interactive shell.
  3. 3

    Get the most out of it

    • Enable the ssl feature to make HTTPS requests and install pip with rustpython --install-pip.
    • Use rustpython -m venv to create a virtual environment for a more pip-friendly setup.
    • Build a WASI module with the freeze-stdlib feature to run RustPython in WebAssembly environments.
    • Enable the experimental jit cargo feature and call __jit__() on a function to try native compilation.
    • Read the examples/hello_embed.rs and examples/mini_repl.rs files if you want to embed it in a Rust project.

Downloads

Strengths

  • Written entirely in Rust, not built on CPython bindings, according to its stated goals
  • Supports compilation to WebAssembly and WASI, including an online demo
  • Has an MIT license and an active, public contributor community with a Discord

Trade-offs

  • The README describes it as in development and not totally production-ready
  • Packaging is limited; the README notes there is no well-packaged installation, and pip needs extra SSL setup
  • The JIT compiler is described as very experimental

How it compares

ProjectStarsTypeLevelUpdatedBest for
RustPython (this)22.5kOtherintermediate4 days agoDevelopers who want to experiment with a Python interpreter written in Rust
ruff50.4kCLIbeginner4 days agoPython developers who want one tool for linting and formatting
v38.1kOtherintermediate4 days agoDevelopers who want to try a compact compiled language with a short learning curve
zig43.3kLibraryadvanced11 months agoDevelopers who want to explore or follow the Zig language project
rich57.7kLibrarybeginner5 months agoPython developers who write command-line scripts and want clearer output
typer20.2kLibrarybeginner5 days agoPython developers writing small or medium command-line tools

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.