Python 3.11.3 Β· Pyodide 0.29.3 Β· WebAssembly

Technical Overview

How Pyroom runs Python in the browser β€” runtime, architecture, supported APIs, and available packages.

Python Runtime

Python Version
3.11.3
CPython β€” full language spec
Execution Engine
Pyodide 0.29.3
CPython compiled to WebAssembly
Execution Thread
Web Worker
Non-blocking β€” UI stays responsive

Pyroom uses Pyodide β€” a port of CPython to WebAssembly β€” to run Python entirely in the browser. No server executes your code. Everything runs locally in your browser tab via a Web Worker.

The Python standard library is fully available: math, random, datetime, json, re, collections, itertools, functools, io, sys, os.path, dataclasses, typing, enum, pathlib, and more.

  • Threading (threading, multiprocessing) is not supported β€” WebAssembly runs single-threaded
  • Real filesystem access is not available β€” os.listdir, file open/write are sandboxed
  • Raw network sockets (socket) are not available in the browser

Architecture

Python runs entirely in the browser β€” no server involved. The runtime is isolated from the editor so the UI stays responsive even during heavy computation.

On iOS/iPadOS the same features are available, though performance may vary slightly compared to desktop browsers.

AI Assistant Stack (Experimental)

Note: AI Assistant is experimental. Output quality, speed, and model availability can vary by device tier, browser, and memory limits.
Library
@huggingface/transformers
Transformers.js β€” runs in browser via ONNX Runtime Web
Inference Backend
ONNX Runtime Web
WebAssembly backend; dtype fallbacks for constrained devices
Offline Support
Browser cache
Models cached after first load; usable in offline-capable scenarios
  • Explanation layer: browser-hosted text-generation pipeline for code and error explanations
  • Translation layer: ONNX translation pipelines for selected output languages (EN, UA, ES, DE, FR)
  • Execution mode: runs on wasm backend; dtype fallbacks improve compatibility on constrained devices
  • Safety fallbacks: when model loading is not possible, Pyroom falls back to heuristic explanations so the assistant remains usable

Custom Tkinter Implementation

Note: Pyroom does not use the real tkinter module. It ships a custom Python-level shim that maps Tkinter API calls to browser DOM operations.

The standard tkinter is built on top of Tcl/Tk β€” a desktop GUI toolkit that cannot run in a browser. Pyroom implements a tkinter compatibility layer consisting of two parts:

  • Python shim β€” a tkinter module written in Python that intercepts widget creation and method calls, forwarding them via the JS bridge
  • JS renderer β€” a TypeScript module on the main thread that translates widget operations into real DOM elements rendered inside the Preview panel

Supported Tkinter API:

  • Tk(), mainloop(), title(), geometry()
  • Button, Label, Entry, Frame, Text, Canvas
  • Listbox, Scrollbar, Scale, Checkbutton, Radiobutton
  • Menu, menu.add_command(), menu.add_cascade(), menu.add_separator()
  • messagebox.showinfo(), showwarning(), showerror(), askyesno(), askokcancel()
  • filedialog.askopenfilename(), filedialog.asksaveasfilename() (browser prompt-based)
  • .pack(), .grid(row, column, columnspan, rowspan), .place(x, y, width, height)
  • .config() / .configure(), .cget(), .bind(), .focus_set()
  • StringVar, IntVar, BooleanVar, .get() / .set()
  • after(ms, callback), after_cancel()

Known limitations compared to desktop Tkinter:

  • Advanced widget styling, custom fonts, and bitmap images have limited support
  • messagebox uses async DOM modal dialogs (not blocking like desktop)
  • filedialog uses browser prompt β€” no real file picker
  • Canvas arc, image, and bitmap items are not implemented
  • Toplevel (secondary windows) is not supported

Turtle Graphics

Similar to Tkinter, Pyroom replaces the standard turtle module with a custom implementation that renders drawing commands onto an SVG canvas in the Preview panel.

  • All standard movement commands: forward(), backward(), left(), right(), goto(), setx(), sety()
  • Pen control: penup(), pendown(), pencolor(), pensize(), speed()
  • Fill operations: begin_fill(), end_fill(), fillcolor()
  • Drawing helpers: circle(), dot(), write(), clear(), reset()
  • Screen: bgcolor(), title(), screensize()

Monaco Editor

Pyroom uses Monaco Editor β€” the same editor that powers VS Code β€” for code editing.

  • Python syntax highlighting
  • Autocomplete and IntelliSense for Python built-ins
  • Undo / redo history
  • Configurable font size and theme (dark / light / auto)

Available Packages

Pyodide bundles a large set of scientific, data, and utility packages that can be imported directly. Packages are loaded on-demand when your code first imports them, or you can pre-load them via Libs settings in the playground.

Full list: pyodide.org β†’ Packages in Pyodide

Scientific & Math

numpyscipysympympmathstatsmodelsautograduncertaintiesiminuitnlopt

Data & DataFrames

pandaspyarrowxarrayfastparquetxlrdpython-calamine

Visualization

matplotlibbokehaltairPillowimageiowordcloudsvgwrite

Machine Learning

scikit-learnlightgbmxgboostriver

Networking & HTTP

requestshttpxaiohttppyodide-http

Parsing & Text

beautifulsoup4lxmlnltkregexpyparsing

Graphs & Networks

networkxigraphrustworkx

Serialization

pyyamlmsgpackorjsonujsonprotobufcryptography

Installing unlisted packages

Packages not bundled with Pyodide can be installed at runtime using micropip (pure-Python packages from PyPI):

import micropip
await micropip.install("package-name")

Accessibility & Font Support

Pyroom supports reading-focused font presets on the website and in the playground UI. Available options include default UI font, Lexend, OpenDyslexic, and a Large text mode.

  • Font selection is available from the top navigation bar and applies immediately without page reload
  • Settings are persisted in localStorage and synced with the shared accessibility profile key (pyroom:accessibility-profile)
  • Website typography uses CSS variables so font family and base size can be switched globally while keeping navigation controls compact and stable
  • Local bundled font assets are shipped for Lexend and OpenDyslexic to avoid dependency on third-party font CDNs for accessibility presets