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.1.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.1-py3-none-any.whl (302.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotframe-1.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9f911cb6dfad5ca09ca5a5ca0b59a9d695a651816a83e5762353daa3fe890894
MD5 245ab6af32156b940d09e29fa7fc6aa5
BLAKE2b-256 0ca09bf85407620b39ea80070d3819c7cbc594a8c4c3b756f6258299e63f8332

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotframe-1.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: hotframe-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 302.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fad06f4a0921d16a68d6a52666f047025e57ef6dc314e882c7aca1a62d224ea8
MD5 c38c90b0fc0284086d54573c03f8b05f
BLAKE2b-256 c85aa50a9bbba7b5dfc1c51df2e7bb423377c1b7149461c9e6e32d8c1f1420a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotframe-1.3.1-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