Skip to main content

Modular Python web framework with hot-mount dynamic modules and stateful, WebSocket-driven LiveComponents — FastAPI + SQLAlchemy + Jinja2.

Project description

hotframe

Modular Python web framework with hot-mount dynamic modules and stateful, WebSocket-driven LiveComponents.

Python 3.12+ License PyPI

hotframe.dev


What hotframe is

hotframe is a Python web framework that combines FastAPI, SQLAlchemy 2.0, and Jinja2 under Django-like ergonomics. It adds two pieces:

  • A hot-mount module engine — install, activate, deactivate, and uninstall plugins at runtime without restarting the process.
  • LiveComponent — stateful, server-rendered components driven by a single WebSocket per page. Server holds the state; the client streams events and applies HTML patches with morphdom. No client-side framework, no build step.

Install

pip install hotframe

Quickstart

hf startproject myapp
cd myapp
hf runserver
INFO  hotframe.bootstrap   Application started in 142ms
INFO  uvicorn.error        Uvicorn running on http://127.0.0.1:8000

A LiveComponent in 30 seconds

# modules/todo/components/todo_list/component.py
from hotframe.live import LiveComponent, event
from modules.todo.models import Todo

class TodoList(LiveComponent):
    user_id: int                      # prop
    items: list = []                  # state
    new_text: str = ""

    async def on_mount(self) -> None:
        self.items = await Todo.where(user_id=self.user_id).all()

    @event("toggle")
    async def toggle(self, todo_id: str) -> None:
        t = next(t for t in self.items if str(t.id) == todo_id)
        t.done = not t.done
        await t.save()

    @event("add")
    async def add(self) -> None:
        if not self.new_text.strip():
            return
        await Todo.create(user_id=self.user_id, text=self.new_text)
        self.items = await Todo.where(user_id=self.user_id).all()
        self.new_text = ""
{# modules/todo/components/todo_list/template.html #}
<ul>
{% for todo in items %}
  <li>
    <input type="checkbox" {% if todo.done %}checked{% endif %}
           data-on:click="toggle:{{ todo.id }}">
    {{ todo.text }}
  </li>
{% endfor %}
</ul>
<form data-on:submit="add">
  <input data-bind="new_text">
  <button type="submit">Add</button>
</form>
{# any page template #}
{% extends "shared/base.html" %}
{% block body %}
  {% live "todo_list" user_id=user.id %}
{% endblock %}

That's it. Click the checkbox — the server toggles the todo, sends an HTML patch back, the DOM updates without a page reload, and the dev wrote zero JavaScript.

Documentation

Full docs, guides and live examples at hotframe.dev.

License

Apache License 2.0 — see LICENSE.

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

hotframe-1.3.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

hotframe-1.3.0-py3-none-any.whl (301.0 kB view details)

Uploaded Python 3

File details

Details for the file hotframe-1.3.0.tar.gz.

File metadata

  • Download URL: hotframe-1.3.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hotframe-1.3.0.tar.gz
Algorithm Hash digest
SHA256 7d094fe98b67c808b60a3ddb9ff020534fbbff1103f5c9b7d56685467f78e00b
MD5 17e589863ced0a9fa0b7e6d2d29e7042
BLAKE2b-256 0abbe5168b3a89c586bddca2c430bef18760937c9c9c0e995b8dfa931a5c7481

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotframe-1.3.0.tar.gz:

Publisher: release.yml on hotframe/hotframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hotframe-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: hotframe-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 301.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hotframe-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d5ab5ffc9c3b7e1890af4355fdbf21b1f64ccb7436ae6e63cec6408c4bdd6f
MD5 467e674bed5c80ad4d9869202823ae60
BLAKE2b-256 87263f14830f6ff6fa0e403db5cca0754b902cfb6335712e4348139ccb4b8c3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotframe-1.3.0-py3-none-any.whl:

Publisher: release.yml on hotframe/hotframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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