Skip to main content

Declarative SSR Framework

Project description

🍃 TeaLeaf

TeaLeaf is a declarative web framework for Python — it lets you build dynamic, reactive web apps using pure Python, without writing templates or frontend JavaScript manually.


✨ Overview

TeaLeaf merges ideas from modern frontend frameworks like React, Svelte, and SolidJS with the simplicity of traditional Python web servers.

You declare HTML directly in Python, manage reactive state via Store objects, and TeaLeaf takes care of keeping everything in sync — automatically.


🚀 Quick Example

from TeaLeaf.Server.WSGI import WSGI
from TeaLeaf.Magic.Store import Store, SuperStore
from TeaLeaf.Html.Elements import div, h3, button

# Create the server
app = WSGI()
SuperStore(app)

# Reactive server-side store
counter = Store({"count": 0})

@app.route("/")
def home():
    return div(
        button("-").attr(onclick=counter.do.update("count", -1)),
        h3(counter.react("count")),
        button("+").attr(onclick=counter.do.update("count", 1)),
    )

application = app.wsgi_app

if __name__ == "__main__":
    from wsgiref.simple_server import make_server
    with make_server("", 8000, application) as server:
        print("Serving at http://127.0.0.1:8000")
        server.serve_forever()

Open your browser and visit http://127.0.0.1:8000 — you’ll see a fully reactive counter built with only Python

Key Features

  • Declarative HTML components — build DOM structures with Python functions
  • Path-based routing — simple, expressive route definitions
  • Reactive server state (Store, AuthStore) — auto-sync between backend and UI
  • JS transpilation (JSCode, JSDO) — write JavaScript logic directly in Python
  • Session support — cookies and per-user AuthStore state

Roadmap

  • Declarative HTML components
  • Path mapping
  • Server Side State (Stores)
  • JS transcription from python
  • Client Side state
  • State hooks
  • Template system
  • Persistent Store (redis,SQL...)
  • CLI
  • Render optimisation

Documentation

Full documentation is available in the Wiki

Status

TeaLeaf is currently in alpha. It’s stable enough for experimentation and small demos, but the public API might still change before beta.

License

MIT License © 2025 — TeaLeaf Framework Made with 🍃 and Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

htealeaf-0.3.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

htealeaf-0.3.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file htealeaf-0.3.0.tar.gz.

File metadata

  • Download URL: htealeaf-0.3.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for htealeaf-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fdf144022004ad685bcb27e9d2f137c971ce8247e6798fe207233e6e0e0692ac
MD5 fb4f205f6a7091051b302a29fe77eda6
BLAKE2b-256 8e099a279da635ab38b494a9ba0f7a9c22ea97c9d4bbb6d1ac2c34597b824b4e

See more details on using hashes here.

File details

Details for the file htealeaf-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: htealeaf-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for htealeaf-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac4fff82bb4e3b384c962763ab41ecc7bd3fc6f9fb8d6e6e4001a76c785d8d55
MD5 f90b7458506496dc58c59220abf45de9
BLAKE2b-256 4f34c966acc0b014c51e329c56d89be7a2ca6abcdd2b36ea22c1534544e74e11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page