Skip to main content

Use Python to execute simple Rust code by running it on

Project description


Pypi Version Build Status

This is a small tool written in Python which allows you to compile simple Rust code through


You can install this package from PyPi.

pip install rust-playground

You can also clone this repository locally and run

python install


usage: playground [-h] [--release] [--channel {stable,nightly,beta}]
                  [--target {llvm-ir,wasm,asm,mir,ast}] [--disable-color]

Use Python to execute simple Rust code by running it on https://play.rust-

positional arguments:
  FILE                  path to file containing Rust code

optional arguments:
  -h, --help            show this help message and exit
  --release             build artifacts in release mode, with optimizations
                        (default: False)
  --channel {stable,nightly,beta}
                        set Rust channel (default: stable)
  --target {llvm-ir,wasm,asm,mir,ast}
                        build for the target triple (default: ast)
  --disable-color       disable colors and styles for stderr (default: False)


Say you want to quick test some Rust code but your current machine doesn't have the Rust compiler installed.

fn main() {
    for x in 1..5 {
        println!("{}", x);
$ playground
   Compiling playground v0.0.1 (file:///playground)
    Finished dev [unoptimized + debuginfo] target(s) in 2.36s
     Running `target/debug/playground`

It reads your and passes it to for compilation and then returns stdout/stderr output on your terminal, which looks very alike to $ cargo run.



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rust-playground, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size rust_playground-0.1.1-py2.py3-none-any.whl (4.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page