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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotframe-1.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 55961002c83b978a5de6b4e89a45c679a1b215b9bc596d579798ba8ff58e2149
MD5 4e1f3b4898753b98192876bee956aa1a
BLAKE2b-256 55ded1dba0f72d7ad58f13372ea1c2178ece093a856a3c15ad2bfd42d6c53e96

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hotframe-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 301.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 725e8176da66c3ce3d39b35b2ba8dd971a527ad7b4b14a32def02f7e7f00390a
MD5 685a1c1eb888ffbf76ec891a798d0d9f
BLAKE2b-256 b6e5e57320574a57fac0808073e44e7196ba72847551e30e49fb8659406852a6

See more details on using hashes here.

Provenance

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