Skip to main content

Modular Python web framework with hot-mount dynamic modules — FastAPI + SQLAlchemy + Jinja + HTMX + Alpine.

Project description

HotFrame

Modular Python web framework with hot-mount dynamic modules.

Python 3.12+ License PyPI


What is hotframe

hotframe is a Python web framework that unifies FastAPI, SQLAlchemy 2.0, Jinja2, HTMX, and Alpine.js under Django-like ergonomics. It adds a hot-mount module engine — load and unload plugins at runtime without restarting the process — and a Turbo/Livewire-style HTMX layer for server-driven UI. Built for teams who want the productivity of Rails or Django with the async performance of FastAPI.


Quickstart

pip install hotframe
hf startproject myapp
cd myapp
hf runserver
INFO     hotframe.core - Loading kernel modules...
INFO     hotframe.modules - Mounted: core, auth, admin (3 modules)
INFO     hotframe.server - Uvicorn running on http://127.0.0.1:8000
INFO     hotframe.server - Press CTRL+C to quit

The CLI installs two aliases: hf (short) and hotframe (explicit).


Key Features

  • Hot-mount dynamic modules — Load and unload Python modules at runtime via a DB registry with topological dependency resolution. No process restart required.

  • HTMX layer (Turbo/Livewire-style)@htmx_view decorator, named frames, TurboStream responses, out-of-band swaps, and server-sent event broadcasting. Build rich UIs without writing JavaScript.

  • Django-like ergonomicsAppConfig, settings.py, management commands, scaffolding CLI. Familiar conventions so teams onboard in minutes, not days.

  • AsyncEventBus + HookRegistry — WordPress-style actions and filters across modules. Decouple features without tight imports. Fully async-native.

  • SQLAlchemy 2.0 + Alembic — Async sessions, per-module migration namespaces, and automatic migration discovery. No shared migration root.

  • Jinja2 + Alpine.js integration — Template inheritance, context processors, CSP-safe nonce injection, and Alpine.js wired out of the box.

  • OpenTelemetry observability — Traces, metrics, and structured logs built into the request lifecycle. Zero extra setup for OTLP exporters.

  • CLI scaffoldinghf startproject, hf startapp, hf startmodule, hf makemigrations, hf migrate. Generate production-ready skeletons from the command line.

  • Interactive shellhf shell opens a Python REPL with the app fully booted: app, settings, db, events, hooks, slots, and runtime are pre-loaded. Use it for ad-hoc queries, slot debugging, or inspecting module state. Install pip install "hotframe[shell]" for the optional IPython backend with auto-await.

  • Reusable components — Server-rendered UI widgets with a required template.html and optional Pydantic-typed props, colocated HTTP routes, and per-component static assets. Apps and hot-mount modules contribute components; hf startproject scaffolds alert and badge as editable examples. Invoke from any template via {{ render_component('name', ...) }} or {% component 'name' %}...{% endcomponent %}.


Comparison

Feature Rails Turbo Laravel Livewire Phoenix LiveView Django + htmx hotframe
Language Ruby PHP Elixir Python Python
Server-driven UI Yes Yes Yes Partial Yes
Hot-reload modules No No No No Yes
Async-native No No Yes No Yes
ORM ActiveRecord Eloquent Ecto Django ORM SQLAlchemy 2.0
Per-module migrations No No No No Yes
Plugin hooks system No No No No Yes
CLI scaffolding Yes Yes Yes Yes Yes
PyPI installable No No No Yes Yes

Minimal Example

Define a module with a model, a route, and a template in under 20 lines:

# modules/blog/module.py
from hotframe import ModuleConfig

class BlogModule(ModuleConfig):
    name = "blog"
    version = "1.0.0"
    dependencies = ["core", "auth"]
# modules/blog/models.py
from hotframe import Base
from sqlalchemy.orm import Mapped, mapped_column

class Post(Base):
    __tablename__ = "blog_posts"
    id: Mapped[int] = mapped_column(primary_key=True)
    title: Mapped[str]
    body: Mapped[str]
# modules/blog/routes.py
from fastapi import APIRouter, Request
from hotframe import htmx_view, DbSession
from .models import Post

router = APIRouter()

@router.get("/blog")
@htmx_view(module_id="blog", view_id="list")
async def post_list(request: Request, db: DbSession):
    posts = await db.execute(select(Post))
    return {"posts": posts.scalars().all()}
<!-- modules/blog/templates/blog/index.html -->
<div hx-get="/blog" hx-trigger="every 30s" hx-swap="innerHTML">
  {% for post in posts %}
    <article>{{ post.title }}</article>
  {% endfor %}
</div>

Architecture Overview

hotframe is organized in three layers:

Runtime layer — the framework kernel. Boots FastAPI, wires middleware, initializes the DB engine, and exposes the public API (@htmx_view, router, settings, EventBus, HookRegistry).

Module layer — each module is a Python package with a ModuleConfig subclass, its own models, views, templates, migrations, and static assets. The module engine resolves dependency order, mounts routes and Alembic migration contexts, and registers hook namespaces. Modules can be installed, uninstalled, enabled, and disabled at runtime via the admin API without touching the running process.

HTMX layer — sits on top of FastAPI responses. The @htmx_view decorator detects HX-Request headers and returns partial renders or full-page responses automatically. TurboStream helpers produce text/vnd.turbo-stream.html responses for out-of-band DOM updates. The EventBus integrates with server-sent events for real-time broadcasting to named HTMX frames.

The CLI (hf) is a Typer application that wraps Uvicorn, Alembic, and the scaffolding generators. It reads settings.py from the project root and discovers modules automatically from the modules/ directory.


Documentation

Documentation is available in the docs/ directory.


License

Apache 2.0. Copyright 2026 ERPlora.


Contributing

See CONTRIBUTING.md. Feedback and issue reports are welcome while the project is in pre-alpha. Code contributions open on first stable release.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotframe-0.0.7.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-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e3cfb1821bead7a3be57be0b8f60ab4e0812bc5917dfd8f380979ce25f831508
MD5 9081c9d0ba91fd903cd82f4f3fb74ee2
BLAKE2b-256 edfbce2c7a29fb3b5df1ebe0187d93f095381450d31cfd9ca880e85313b635fb

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on ERPlora/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-0.0.7-py3-none-any.whl.

File metadata

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

File hashes

Hashes for hotframe-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 aa7f9e6609c66cc062476793f0908488145514ff60d1755715267e2c264b814a
MD5 e3fc668a339458517f65d67fa1ed16a7
BLAKE2b-256 9a2f4c3e2baa3238e2608c371dfecbed8f3166cb5d7aa29d305f339b074fc22a

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on ERPlora/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