Skip to main content

PyWeb

Full-stack web apps in one Python file. Server-rendered pages, reactive browser UI compiled from Python, and typed calls to server functions, without a JavaScript toolchain.

CI Docs Python PyPI License

from pyweb import App, server

app = App(title="Guestbook")
ENTRIES = []


@server
def sign(name: str) -> list:
    ENTRIES.append(name.strip() or "anonymous")
    return ENTRIES


@app.page("/")
def Home():
    entries = list(ENTRIES)     # computed on the server per request
    name = ""                   # bound to the input: browser state

    def submit():               # compiled to JavaScript
        entries = sign(name)    # typed RPC to the server
        name = ""

    <main>
        <h1>Guestbook ({len(entries)})</h1>
        <form onsubmit={submit}>
            <input bind={name} placeholder="Your name" />
            <button>Sign</button>
        </form>
        <ul>
            for entry in entries:
                <li>{entry}</li>
        </ul>
    </main>
pip install pyweb-stack   # imported as `pyweb`
pyweb dev app.pyweb        # http://localhost:8000

Why PyWeb

  • Interactions run in the browser. Handlers and expressions are compiled to small JavaScript modules; the server is only contacted when your code calls a @server function. No WebSocket per user, no multi-megabyte Python runtime in the browser.
  • Every page is server-rendered. Complete HTML on first paint, real data from your database, good for SEO and slow devices.
  • You never write an API layer. @server functions get endpoints, argument validation, typed errors and generated browser calls.
  • Plain variables are state. The compiler sees which variables your handlers change and makes exactly those reactive; updates touch only the DOM nodes that read them.
  • Boundaries are checked. Database handles, imports and secrets can't leak into browser code: it's a compile error with a line number. pyweb inspect explains where every name runs and why.
  • Stateless servers. Signed-cookie sessions and plain HTTP RPC scale horizontally behind any load balancer. Deploy with pyweb serve, uvicorn/gunicorn (ASGI) or the generated Dockerfile.

A typical interactive page ships under 1 KB of page code plus a ~10 KB (gzip) runtime that's cached across pages. Pages without interactivity ship no JavaScript.

Is it for you?

Good fit: internal tools, admin panels, dashboards, CRUD apps, small SaaS products and content sites with interactive parts, built by people who'd rather stay in Python.

Not a fit: large client-heavy single-page apps that need the npm ecosystem (use React/Svelte/Vue), or running scientific Python in the browser (use Pyodide/PyScript). See the comparison and current limitations.

Documentation

Start Introduction · Quickstart · Tutorial
Language .pyweb files · State & reactivity · Python in the browser
Server Server functions & RPC · Pages & routing · Data · Auth
Ship Testing · Deployment · Security · CLI
Reference Toolkit & stability · Limitations & roadmap · Architecture · Changelog

The same docs are published at maanavkrishna.github.io/PyWeb, with compiler output shown next to each example.

Examples

Each runs with pyweb dev examples/<name>/app.pyweb and is exercised in a real browser by the test suite.

Example Shows
counter signals, computed values, binding a number input
todo components, list mutation, filters, keyed lists
blog SQL database, server functions, route params, 404s, validation errors
auth registration, password hashing, sessions, protected pages
chat route params, shared server state, polling with on_mount
showcase everything on one page, with a stylesheet

Command line

pyweb new myapp                                  # scaffold
pyweb dev app.pyweb                              # dev server: live reload + error overlay
pyweb inspect app.pyweb                          # where each name runs, and why
pyweb check app.pyweb                            # compile + security checks for CI
pyweb build app.pyweb --out dist --production    # self-contained, hashed, minified dist/
pyweb serve dist                                 # production server (/healthz, CSP, graceful shutdown)

Status

PyWeb 0.1 is the first public release (beta). The language, server API, RPC protocol and CLI are documented and tested, and changes to them are announced in the changelog (see stability). The test suite covers the parser, the Python→JavaScript translation (differentially, against CPython), the reactive runtime, server rendering, RPC, sessions, every example app in Chromium, and the database/Redis layers against real Postgres, MySQL and Redis servers, on Python 3.10–3.13.

Authors

Built by MaanavKrishna and Claude.

Contributing

See CONTRIBUTING.md. Security reports: SECURITY.md. License: MIT.

Metadata

Release files for pyweb-stack 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyweb-stack 0.1.0
File Size Uploaded
pyweb_stack-0.1.0.tar.gz 174.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyweb-stack 0.1.0
File Interpreter ABI Platform
pyweb_stack-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 318.1 kB

Release files / pyweb_stack-0.1.0.tar.gz

Download URL pyweb_stack-0.1.0.tar.gz
Size 174.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fa7d6d3ac2c0e67857cd43354a23636c27676a4aacd46c438c47e1a166311e38
BLAKE2b-256 checksum
How to use checksums
b08073db4786be048aa17b6a20ccd31eef464eb64d66808c6f3b9862d0c8eea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / pyweb_stack-0.1.0-py3-none-any.whl

Download URL pyweb_stack-0.1.0-py3-none-any.whl
Size 143.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
229936e35ee4ec6acb0699e52ee77914c7f36b81652196490f6bdb091dbbac35
BLAKE2b-256 checksum
How to use checksums
b86c9e3c67cfb9ae9122929509cc790e4a8f648c9b86025fa9e5d887a078dc49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page