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.0.0.tar.gz (1.6 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.0.0-py3-none-any.whl (293.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hotframe-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e15ec5bc23e752e6faf46cab8ed5b1e9ba381ef54e4be8a046fd1fd879776136
MD5 78816e3d360c2c60f168b9a18889c3c4
BLAKE2b-256 5c08b664aba35915b88579c19d20e8209ea688b909d92eff1680bbacf98ee110

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hotframe-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 293.3 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b22b2fdfd90e51e7e513b533e45169538d4ab2fcbf8f3a3d592e806a4bb7147
MD5 c0cd23bfd561319f7a9216bead648415
BLAKE2b-256 0822155afc803d170379d598147cb3cb4a84a997515a4db1ddea12167b2de834

See more details on using hashes here.

Provenance

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