Website review
This review may include AI-generated content and is not individually verified. Domain, certificate and other facts come from the observed data on this page.
What is RustPython?
RustPython is an open-source Python 3 interpreter written in Rust, rather than a set of bindings to CPython. Its headline goal is a full Python 3 environment implemented entirely in Rust with a clean design and no compatibility hacks. It targets Python 3 at a CPython 3.11.0-or-newer level and is released under the MIT license.
What makes it different
Most Python implementations exist to fit Python into a particular host platform: Jython targets the JVM, IronPython targets .NET, PyPy is written in Python, and CPython is written in C. RustPython applies that same idea to Rust. Two consequences follow directly from that choice:
- Embedding in Rust applications. You can use Python as a scripting language inside a Rust program, so users of your Rust tool can write extension logic in Python while the host stays in Rust.
- WebAssembly. Rust's minimal runtime lets RustPython compile to WebAssembly, which is how the project runs Python in a browser — there is an online demo and a notebook-style demo on the site.
Ways to get it
The project lists several installation routes: cargo install from the Git repository, wapm install rustpython, and conda install rustpython -c conda-forge, or building from source.
Who it suits
- Rust developers who want an embedded scripting layer without pulling in CPython.
- Web developers exploring Python execution in the browser via WebAssembly.
- Contributors interested in interpreter internals; the project publishes a CPython test-compatibility dashboard and guidance on contributing using CPython's unit tests.
Trade-offs to weigh
Being a separate implementation means it will not match CPython everywhere. The site's own compatibility dashboard exists precisely because full parity is a work in progress, and the "What's left" page signals remaining gaps. If your code depends on C extension modules or exact CPython behavior, that matters more than the language's design elegance.
Next step: if you are considering it for embedding, start with the online WebAssembly demo to sanity-check your Python code, then check the compatibility dashboard against the specific libraries you rely on before committing.
How do I embed RustPython into a Rust application to use Python as a scripting language?
Embedding RustPython means adding it as a dependency in your Rust project and using its API to create an interpreter instance, then executing Python code or exposing Rust functions to Python from your Rust code.
RustPython is a Python 3 interpreter written in Rust. Because it is a native Rust library, it compiles into your application rather than calling out to a separate CPython process. That makes it a natural fit when you want to ship one binary and let users or internal teams extend behavior with Python scripts.
Basic embedding workflow
- Add RustPython as a dependency. The project is distributed through Cargo, so you add the relevant crate to your
Cargo.toml. The exact crate name and feature flags are the part most likely to change, so check the current installation instructions on the project site. - Create an interpreter instance. In your Rust code, initialize a RustPython virtual machine or interpreter object. This owns the Python state for your application.
- Run code. You can execute a string of Python, run a
.pyfile, or evaluate an expression. This is how you implement a scripting hook or a plugin system. - Exchange values. Pass Rust values into Python and read results back. Simple types like numbers, strings and collections are the usual starting point.
- Expose your own functions. Register Rust functions so Python scripts can call back into your application. This is what turns Python from a standalone script runner into a scripting layer for your program.
Where embedding helps, and where it does not
Embedding is most useful when your audience already knows Python and you want them to customize your application without recompiling it. A concrete scenario: a Rust-based data pipeline tool where each customer writes a short Python function to transform records, while your Rust core handles performance-critical I/O.
The trade-offs are real. You take on a large interpreter as a dependency, which affects binary size and build times. Compatibility is a moving target: the project describes itself as targeting CPython 3.11 and above, and its own dashboard tracks CPython test compatibility, which tells you that full parity is a work in progress. If your scripts depend on C extension modules, that is a common friction point for alternative interpreters.
Practical decision criteria
- Choose RustPython embedding when you want Python scripting inside a Rust binary and you control which libraries scripts may use.
- Consider calling out to CPython instead when your scripts need the full ecosystem of C extensions or exact CPython behavior.
- If your goal is running Python in a browser rather than inside a Rust program, look at the WebAssembly path instead of embedding.
- Prototype early with your actual scripts, not a hello-world, so you discover missing modules before committing.
Next step
Start with the smallest possible embed: initialize the interpreter, run print("hello"), then register one Rust function and call it from Python. Once that round trip works, test one real script from your intended users. The project's own site, RustPython, and its repository are the authoritative places to confirm the current crate setup and API, since those details move faster than any guide.
How can I run Python code in the browser using RustPython and WebAssembly?
RustPython can be compiled to WebAssembly, which lets Python code run directly in a browser without a server-side Python process. The project's own site describes this as one of its two main use cases, alongside embedding Python in Rust applications, and it links to an online demo running on WebAssembly. The interpreter is an independent Python 3 implementation written in Rust (targeting CPython 3.11 compatibility), not a set of bindings to CPython.
H3 Practical paths
- Try the hosted demo first. The RustPython site links an online demo that runs on WebAssembly. This is the fastest way to see whether the language coverage suits your code before you build anything.
- Build your own WebAssembly module. Compile RustPython to a
.wasmtarget and load it in a page with JavaScript glue code. This gives you control over which standard-library modules are included and how the module is packaged. - Use an existing distribution. The site lists installation routes including
cargo install,wapm install rustpython, and a conda-forge package, plus instructions to build from source. The wapm route is the WebAssembly-oriented one; the others are more relevant to native or embedded use. - For Python-in-Rust rather than Python-in-browser, embed the interpreter as a Rust library and expose your application's functions to scripts. The WebAssembly path is a separate compilation target, not a requirement for embedding.
H3 What to expect
| Concern | Practical implication |
|---|---|
| Compatibility | The project tracks CPython 3.11 compatibility and publishes a dashboard of CPython test results, so expect gaps rather than full parity. |
| Performance | WebAssembly in the browser is typically slower than native CPython for heavy numeric work; benchmark your own workload. |
| Ecosystem | C extension modules are not usable in this model, so pure-Python packages are the realistic target. |
| Packaging | You control module inclusion, so trimming unused stdlib code keeps the .wasm payload smaller. |
| Licensing | MIT, so commercial and closed-source use is straightforward. |
H3 A concrete scenario
Suppose you maintain a documentation site and want readers to edit and run short Python snippets without a backend. Compile RustPython to WebAssembly, ship the module as a static asset, and wire an editor to it. Pure-Python examples run client-side; anything importing NumPy or a C-backed library will not work, so label those snippets as illustrative only or run them server-side.
If you need a broader browser-based Python environment with a large prebuilt package set, compare against Pyodide, which compiles CPython itself to WebAssembly and therefore carries different compatibility trade-offs. For the Rust side of the story, the language's own documentation at Rust covers the toolchain you will use to build the module.
Next step: open the online demo, paste in a representative snippet from your own project, and note which imports fail. That tells you quickly whether RustPython's compatibility level is sufficient before you invest in a build pipeline.
What are the differences between RustPython and CPython, and how compatible is RustPython with CPython's test suite?
RustPython is an independent Python 3 interpreter written in Rust, not a set of bindings to CPython. Its stated goal is a full Python 3 environment implemented entirely in Rust, with a clean implementation and no compatibility hacks. That single design choice drives most of the practical differences.
How they differ in use
| Dimension | CPython | RustPython |
|---|---|---|
| Implementation language | C | Rust |
| Primary role | Reference interpreter; the default Python most people install | Embeddable interpreter for Rust programs; also compiles to WebAssembly |
| Integration path | C extensions and the C API | Python as a scripting layer inside Rust applications, or Python in the browser via WebAssembly |
| Runtime character | Mature, highly optimized, huge ecosystem | Minimal Rust runtime, easier to target non-native environments |
| Compatibility posture | Defines the language behavior | Aims to match Python 3, but is a separate implementation |
CPython is the sensible default when you need the widest package compatibility, C extensions, or predictable production performance. RustPython makes more sense when the host language or host platform is the constraint: you are writing a Rust application and want users to script it in Python, or you want Python executing in a browser without a server. The project's own framing is that it wants to unlock for Rust what Jython did for Java and IronPython for .NET.
Compatibility with CPython's test suite
Compatibility is treated as a measurable target rather than an assumption. The project publishes a CPython test compatibility dashboard and a "What's left" page, and it describes how to contribute using CPython's unit tests. In practice this means you should read the dashboard as a snapshot of current coverage, not as a claim of full parity — the proportion of CPython tests passing is the number that matters, and it changes over time.
A realistic scenario: you maintain a Rust service and want to let customers write small Python rules. Before committing, take the subset of the CPython test suite closest to the standard library modules you rely on, run it against RustPython, and treat the pass rate as your go/no-go signal. If your scripts depend on C extensions or niche stdlib corners, expect gaps and test them specifically.
For installation routes and current status, start at RustPython. If your goal is browser execution, the project's WebAssembly demo is the fastest way to sanity-check your own script before wiring anything up.
How do I install RustPython using cargo, wapm, or conda?
Install RustPython from the command line using one of three package managers, depending on where you want it to run.
Cargo (Rust toolchain)
Best if you already have Rust installed and want a local rustpython binary.
cargo install --git https://github.com/RustPython/RustPython rustpython
wapm (WebAssembly)
Use this when your target is WebAssembly — for example, running Python in the browser or in a WASI runtime.
wapm install rustpython
conda (conda-forge)
Use this if you manage environments with conda and want RustPython alongside other conda packages.
conda install rustpython -c conda-forge
Choosing between them
| Method | Best for | Trade-off |
|---|---|---|
| Cargo | Rust developers embedding or scripting | Builds from source; needs the Rust toolchain |
| wapm | WebAssembly/browser use | Aimed at WASM, not a general desktop install |
| conda | Existing conda environments | Depends on conda-forge availability |
All three are listed on the project's installation section at RustPython, which also notes the MIT license and links to the GitHub repository.
Next step: after installing, try the online WebAssembly demo or a notebook to check behaviour before wiring RustPython into your own project. If you need a specific version or platform, building from source is the fallback the project documents.
How can I contribute to the RustPython project?
RustPython accepts contributions at several levels, from fixing a single compatibility gap to embedding the interpreter in a new host. The project's own "How to contribute" page is the canonical starting point, and it specifically highlights using CPython's unit tests as a way to find work.
Practical ways in
- Start from failing CPython tests. RustPython tracks its CPython test compatibility on a public dashboard with a "What's left" view. Pick a failing test, reproduce it locally, and submit a fix. This is the lowest-friction path because the expected behaviour is already defined by CPython.
- Work on the interpreter core. That means the parser, compiler, bytecode VM, and standard-library modules implemented in Rust. Expect to read Rust and reason about Python semantics; the project's goal is a clean implementation with no compatibility hacks, so patches that special-case behaviour are likely to get pushback.
- Improve the embedding story. RustPython can be embedded into Rust programs as a scripting language, so examples, documentation, and ergonomics for embedders are useful contributions even without deep VM knowledge.
- Target WebAssembly. Because RustPython compiles to WebAssembly, browser-side issues — startup size, performance, and the online demo and notebook — are a distinct area where web and Rust skills both apply.
- Docs, tooling, and packaging. Installation paths include
cargo install, wapm, and conda-forge, plus building from source. Keeping those instructions accurate is ongoing work.
A concrete first move
Clone the repository, build from source, run the test suite, and find one failing CPython test that you can reproduce in a small script. Fix it, then open a pull request referencing the test. That gives maintainers an easy review and gives you a feel for the codebase before committing to a larger area.
Choosing where to spend effort
| Your background | Best entry point | Trade-off |
|---|---|---|
| Rust developer, new to Python internals | Embedding API, tooling, or a small stdlib module | Less visible than VM work, but fast to land |
| Python developer, new to Rust | CPython test compatibility fixes | Requires learning Rust, but the target behaviour is unambiguous |
| Web developer | WebAssembly build, demo, and notebook | Performance work can be open-ended |
| Technical writer | Installation and contribution docs | High value, low code risk |
For project conventions, issue labels, and the current contributor list, read the repository's contributing guide and issue tracker directly; the project also credits its maintainers and contributors publicly, which is a good way to see who reviews which area. If you want to compare how another implementation structures its contribution process, PyPy documents its own approach, though the codebases and goals differ.
User reviews (0)