simple_module_inertia
Inertia.js v3 server adapter for FastAPI. This is the protocol half of a
simple_module app's React frontend: it turns inertia.render("Users/Index", props)
into either the JSON page object an Inertia visit expects or the HTML document a
full page load expects, and implements every v3 prop type (optional, always,
defer, merge, prepend, deep_merge, once, scroll).
Forked from fastapi-inertia (MIT) —
see NOTICE. Precognition and SSR are not implemented.
Install
simple_module_hosting depends on this package, so any app scaffolded with
smpy new already has it. To use the adapter on its own:
uv add simple_module_inertia
Usage
Inside a simple_module app, reach the per-request Inertia instance through
InertiaDep and import the response type and prop factories from here:
from simple_module_hosting.inertia_deps import InertiaDep
from simple_module_inertia import InertiaResponse, defer, merge, optional
async def index(inertia: InertiaDep) -> InertiaResponse:
return await inertia.render(
"Feed/Index",
{
"posts": merge(load_posts, match_on="id"), # append on navigation
"analytics": defer(load_analytics), # loaded after first paint
"stats": optional(load_stats), # only on partial reloads that ask
},
)
Standalone, configure it once and register the two exception handlers:
from fastapi import Depends, FastAPI
from fastapi.templating import Jinja2Templates
from simple_module_inertia import (
Inertia,
InertiaConfig,
InertiaVersionConflictException,
inertia_dependency_factory,
inertia_version_conflict_exception_handler,
)
config = InertiaConfig(
templates=Jinja2Templates(directory="templates"),
entrypoint_filename="main.tsx",
root_directory=".",
dev_url="http://localhost:5173",
)
inertia_dep = inertia_dependency_factory(config)
app = FastAPI()
app.add_exception_handler(
InertiaVersionConflictException, inertia_version_conflict_exception_handler
)
@app.get("/")
async def home(inertia: Inertia = Depends(inertia_dep)):
return await inertia.render("Home", {"greeting": "hello"})
The root template needs {% inertia_head %} in <head> and {% inertia_body %}
in <body>; the page object lands in <div id="app" data-page="…">.
Metadata
Release files for simple-module-inertia 0.0.35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_module_inertia-0.0.35.tar.gz | 19.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_module_inertia-0.0.35-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.6 kB
Release files / simple_module_inertia-0.0.35.tar.gz
| Download URL | simple_module_inertia-0.0.35.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63dd15461ae7fbe47631f4ecd06ee325cb83a1ca9360b85991d30e0876b54db5
|
|
BLAKE2b-256 checksum How to use checksums |
55d176b34f1d94c2720b686d3221c50e57acb7a2a0d5369490f3b1532bf63a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / simple_module_inertia-0.0.35-py3-none-any.whl
| Download URL | simple_module_inertia-0.0.35-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
feb5774be0b6ab7b572b2a4c0f9feb3ee8f9409ab53451a27c24cdabf1b2438e
|
|
BLAKE2b-256 checksum How to use checksums |
f11577031e816e349b22a0f04a7365143509746db4bc3ea11ef65dbe6a5f66f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log