Skip to main content

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.38

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-module-inertia 0.0.38
File Size Uploaded Provenance
simple_module_inertia-0.0.38.tar.gz 23.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-module-inertia 0.0.38
File Interpreter ABI Platform
simple_module_inertia-0.0.38-py3-none-any.whl Python 3 none any Details

Total release size: 44.4 kB

Release files / simple_module_inertia-0.0.38.tar.gz

Download URL simple_module_inertia-0.0.38.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c19d04b31387a44ef8c846b01064cf13c7ea489bda88e1c8cff4a8ad544c38b9
BLAKE2b-256 checksum
How to use checksums
4f3fb5123c95e1a23149628623e7b477a298c9fac454dda517fea6d30c1371f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Release files / simple_module_inertia-0.0.38-py3-none-any.whl

Download URL simple_module_inertia-0.0.38-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce1df8d716766046cb8d266aaa54e912ddf9e84c9d8707fd2d78801503e8615c
BLAKE2b-256 checksum
How to use checksums
5b63898cf1b0c4c65e083372f04bd9f833e5ce5b837f0155dd2af26056123fb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Security for simple-module-inertia 0.0.38

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_module_inertia-0.0.38.tar.gz

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 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page