GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing rustpython.github.io — RustPython Demo

RustPython Demo

RustPython is a Python interpreter written in Rust. This demo is compiled from Rust to WebAssembly so it runs in the browser.
Input your Python code below and click Run (or Ctrl+Enter), or you can open up your browser's devtools and play with rp.pyEval('1 + 1')

Standard Output

Interactive shell

Here's some info regarding the rp.pyEval(), rp.pyExec(), and rp.pyExecSingle() functions

  • You can return variables from python and get them returned to JS, with the only requirement being that they're serializable with json.dumps.
  • You can pass an options object as the second argument to the function:
    • stdout: either a string with a css selector to a textarea element or a function that receives a string when the print function is called in python. The default value is console.log.
    • vars: an object that will be available in python as the variable js_vars. Only functions and values that can be serialized with JSON.stringify() will go through.
  • JS functions that get passed to python will receive positional args as positional args and kwargs as the this argument

Limited Interaction with browser is possible from Python by using the browser module. Browser APIs such as alert(), confirm(), prompt() and fetch() are included in the module.

Fork me on GitHub
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.