Skip to main content
Io

A mini Python REPL web component

About

Io is web component library for running Python codeblocks in the browser. Its core element is <io-repl>, a mini Python REPL powered by Pyodide.

Try it out! Enter some Python code in the text area below and click the Run button to execute it. You can also use Shift + Enter to run the code.

Quickstart

Add the <io-repl> script to the head of your HTML document:

<script type='module' src='https://www.unpkg.com/io-repl/io-repl.js'></script>

Add the following rule to your stylesheet to prevent the component from being displayed until its ready:

io-repl:not(:defined) {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

Use <io-repl> in your HTML document:

<io-repl>import this</io-repl>

For a more comprehensive usage guide, refer to Io's README.

License

Copyright © 2023 Suzen Fylke. Distributed under the MIT License.

Acknowledgements

This project was scaffolded with open-wc's web component generator.

It forks PyScript's ltrim function to dedent code input, and parts of its design are heavily influenced by the design of PyScript's web components. PyScript is licensed under the Apache 2.0 License.