Skip to content

Python in the browser

Oxid

A fine-grained reactive UI framework for Python, running in the browser on its own runtime compiled to WebAssembly. An app is a directory of static files: no server, no build step, no JavaScript toolchain. Signals, memos and effects update the exact text node that changed — the framework, the interpreter and the loader are downloaded once.

uvx oxid build myapp/ --out site/

A counter, whole

from oxid import Signal, component, html, mount

@component
def counter():
    count = Signal(0)

    def inc(ev):
        count.update(lambda n: n + 1)

    return html(t"""
        <button on:click={inc}>clicked {count} times</button>
    """)

mount(counter, "#app")

Apache 2.0 · the wheels of every release stay at /dist/, because the chapters and their apps pin one by URL.