Pyodide Script Runner Generator

Write Python code, pick the scientific packages you need, and generate a self-contained HTML file with Pyodide embedded. Opening that generated file runs your Python for real via Pyodide — this builder page itself does not execute Python.

FreeOnline Tool
Loading…

How to Use

  1. Click a card under "Select a Preset" (Hello World, NumPy matrix operations, Pandas data processing, Matplotlib plotting) to load a complete Python example, or write your own code directly in the editor.
  2. Under "Select Python Packages to Load," check the packages your code needs (numpy, pandas, matplotlib, scipy, and other packages Pyodide supports) — this automatically adds a pyodide.loadPackage() call to the generated file.
  3. Customize the page title if you like, and toggle "Auto-run after loading" to decide whether the generated page runs your code automatically once Pyodide finishes loading (otherwise the user clicks "Run Python" manually on the generated page).
  4. Click "Copy Full HTML Code" to grab the generated markup for your own deployment, or "Download as .html File" to get a standalone file you can open directly in a browser.
  5. When the downloaded HTML file is opened, it loads the real Pyodide runtime from a CDN (cdn.jsdelivr.net/pyodide, roughly 10MB — users in mainland China may need a mirror), then genuinely executes your Python code in the browser, with print output shown on the page.

Features

  • Four built-in Python examples: Hello World, NumPy matrix operations (inverse/determinant/eigenvalues), Pandas data processing (DataFrame creation and group-by stats), and Matplotlib plotting (renders a chart and outputs it as a base64 image).
  • 12 selectable tags for common Pyodide packages: NumPy, Pandas, Matplotlib, SciPy, scikit-learn, SymPy, Pillow, Requests, BeautifulSoup4, lxml, PyYAML, and micropip.
  • Generates a complete, self-contained single-file HTML page (inline styles and script) that dynamically imports Pyodide (v0.26.4) via an ES module, capturing print output through pyodide.setStdout/setStderr and displaying it on the page.
  • Configurable page title, and a toggle for whether the generated page auto-runs the code once Pyodide is ready.
  • Copy the generated HTML source with one click, or download it directly as pyodide-runner.html.
  • Important boundary: this builder page itself never loads Pyodide or executes any Python — the real Python execution happens only after the downloaded/copied standalone HTML file is opened, and it requires network access to cdn.jsdelivr.net.

Use Cases

Share a Python demo that runs without a Python install
Want to show someone a piece of Python logic without asking them to set up a Python environment — generate a single-file HTML they can double-click open and see run for real in their browser.
Quickly check whether a NumPy/Pandas snippet works under Pyodide
Planning to move some data-processing logic to run client-side via Pyodide — select the matching packages here first to confirm the code has no compatibility issues in the Pyodide environment.
Build a browser-based Python exercise page for teaching
Want to give students a practice environment that runs Python with nothing to install beyond a browser — start from a preset and modify the code as needed.
Generate a self-contained analysis report with an embedded chart
Start from the Matplotlib preset, write analysis code that renders a chart as a base64-embedded image, and open the generated standalone HTML to see the chart directly with no external image file dependency.

FAQ

If I click "Run" on this page, does my code execute right here?
No. This page only handles editing code, selecting packages, and generating HTML text — it never loads Pyodide or runs Python itself. Real execution only happens after you download or copy out the generated standalone HTML file and open it.
Does the generated HTML file need an internet connection when opened?
Yes. It dynamically loads the Pyodide runtime (about 10MB) and your selected packages from a CDN (cdn.jsdelivr.net/pyodide) — an internet connection is required the first time it's opened, though the browser may cache some assets afterward. Access to that CDN can be unreliable from mainland China, which the tool's own notes mention; you may need to swap in a mirror.
Why does the Matplotlib preset end up printing an HTML text snippet instead of showing a chart?
The Matplotlib preset uses the non-interactive Agg backend, saves the figure as a PNG, base64-encodes it, and prints an <img> tag as text — you can paste that text into another HTML page to view the image, but it doesn't render inline by itself.
Can I select any of the built-in packages, and what happens if I check one I don't actually use?
All 12 listed packages are common Pyodide-ecosystem packages for scientific computing or networking. Checking one adds it to the generated file's pyodide.loadPackage() call; checking a package your code never imports just makes the page load slower and download unused data — it won't cause a runtime error.