Larz › Blog › Larz 2.0: Async, WebSockets & a pure-Python PostgreSQL driver

Larz 2.0: Async, WebSockets & a pure-Python PostgreSQL driver

July 27, 2026 · Larz OS

An async core with WebSockets, and Postgres support written from scratch โ€” both with zero dependencies. Larz is now feature-complete against its roadmap.

The two things I said were honestly deferred โ€” a real async core and Postgres โ€” are both here, and both keep the promise: zero dependencies.

pip install --upgrade larz     # 2.0.0

Async & WebSockets

The Larz app is now dual-protocol: the same object runs under WSGI (gunicorn) and ASGI (uvicorn/hypercorn), detected automatically. Handlers can be async def or sync.

@app.get("/feed")
async def feed(req):
    data = await fetch_async()
    return {"items": data}

@app.websocket("/ws/")
async def chat(ws):
    await ws.accept()
    async for msg in ws:
        await ws.send("echo: " + msg)

A built-in async server โ€” no uvicorn needed

Because "runs on your machine with nothing to install" should stay true even for async, Larz ships its own zero-dependency asyncio server that speaks HTTP/1.1 and RFC 6455 WebSockets:

app.run_async()      # http + websockets, pure stdlib asyncio

Production can still use any ASGI server โ€” the app is a standard ASGI callable (uvicorn module:app). But you don't need one.

Postgres โ€” written from scratch

The ORM shipped with sqlite. 2.0 adds a pure-Python PostgreSQL driver โ€” the v3 wire protocol with modern SCRAM-SHA-256 authentication (it matches the RFC 7677 test vector), plus md5 and cleartext, and parameterized, injection-safe queries. No psycopg, no libpq.

from larz.models import connect
connect("postgres://user:pass@localhost:5432/mydb")   # the ORM now uses Postgres
# sqlite stays the zero-config default: connect("app.db")

It's verified end to end against a live PostgreSQL 15 server โ€” the full ORM (inserts with RETURNING, typed round-trips, migrations, queries) runs on it unchanged.

Feature-complete

That closes the roadmap. Larz is now money-native, AI-native, has FastAPI-style typed ergonomics, an async core with WebSockets, and both sqlite and Postgres โ€” all with zero runtime dependencies, and nothing that phones home. See the changelog and the async chat example.

Read the docs PyPI

FAQ

Does the Postgres driver really have no dependencies?

Correct โ€” larz.pg implements the PostgreSQL v3 wire protocol and SCRAM-SHA-256 auth using only the standard library (socket, hashlib, hmac, struct, base64). No psycopg, no libpq.

Do I need uvicorn to run async?

No. Larz ships a built-in zero-dependency asyncio server (app.run_async()) that handles HTTP and WebSockets. You can still use uvicorn/hypercorn in production โ€” the app is a standard ASGI callable.

Is sqlite still the default?

Yes. connect('app.db') uses sqlite with zero setup; connect('postgres://โ€ฆ') switches the same ORM to Postgres. Nothing else in your code changes.

release2.0