Skip to main content

Anza (Python Engine)

A zero-dependency template and dynamic fragment rendering library for Python web applications.

What It Does

  1. Full-Page Rendering: Renders full HTML pages with <template shadowrootmode="open"> Declarative Shadow DOM shells.
  2. Dynamic Fragment Envelopes: Renders targeted HTML partials inside JSON Envelope payloads for partial UI updates.
  3. Payload Signing: Signs dynamic payloads with HMAC-SHA256 or Ed25519 so clients can verify partial updates.
  4. Streaming: Helpers for Server-Sent Events (SSE) and WebSocket message formats.
  5. No Mandatory Dependencies: Built entirely on the Python Standard Library.

Installation

pip install anza

Usage

1. Initialize Engine

from anza import Setup, SignOptions

engine = Setup(
    root="./templates",
    signing=SignOptions(mode="hmac", secret="your-secret-key-at-least-32-chars-long"),
).run()

2. Render Full Pages

from anza import Page

# Renders full HTML page with parameters interpolated into slots
doc = Page("/", {"title": "My Application"}).run(engine)
print(doc.html)

3. Render Signed JSON Fragments

from anza import Fragment

# Renders a specific template fragment targeting a slot
envelope = Fragment("card.html", "feed", {"title": "New Post"}).run(engine)

# envelope contains: slot, html, ts, and signature
print(envelope.to_dict())

4. FastAPI Integration Example

from fastapi import FastAPI
from fastapi.responses import HTMLResponse, JSONResponse
from anza import Setup, Page, Fragment, SignOptions

app = FastAPI()

engine = Setup(
    root="./templates",
    signing=SignOptions(mode="hmac", secret="your-secret-key-at-least-32-chars-long"),
).run()

@app.get("/", response_class=HTMLResponse)
def home():
    doc = Page("/", {"title": "Home"}).run(engine)
    return HTMLResponse(doc.html)

@app.get("/api/card/{card_id}")
def card(card_id: str):
    env = Fragment("card.html", "feed", {"id": card_id, "title": "Live Post"}).run(engine)
    return JSONResponse(env.to_dict())

License

MIT © 2026 aduki, Labs

Metadata

Release files for anza 0.5.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 anza 0.5.0
File Size Uploaded Provenance Actions
anza-0.5.0.tar.gz 17.8 kB Without provenance Details for anza-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anza 0.5.0
File Interpreter ABI Platform Actions
anza-0.5.0-py3-none-any.whl Python 3 none any Details for anza-0.5.0-py3-none-any.whl

Total release size: 39.0 kB

Release files / anza-0.5.0.tar.gz

Download URL anza-0.5.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d0fdac0b6939dc8d91fe292e4b08c42a874e64070968d1704a68d1b490ed57df
BLAKE2b-256 checksum
How to use checksums
d55e6431a2ad4400d394e9482872a06aeb43aef05658592b9530b74886b5588a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / anza-0.5.0-py3-none-any.whl

Download URL anza-0.5.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aea86cdb831b4d3d50fbf233664e9087606311f2b08eb3e4d2fa9aef89434e6
BLAKE2b-256 checksum
How to use checksums
333a60a94a1270a100edfbeeb6aae47ca783205639c96aca143ece8cba4b2887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for anza 0.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

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