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

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.39
File Size Uploaded Provenance
simple_module_inertia-0.0.39.tar.gz 23.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 44.5 kB

Release files / simple_module_inertia-0.0.39.tar.gz

Download URL simple_module_inertia-0.0.39.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
906e78361023b35332e6fc061155c9f85a46dabe57d2cbde725b7c79bd3d1401
BLAKE2b-256 checksum
How to use checksums
3b54adeab0f897451daf65cac1f0446566a13b4740985ed2759666dc774af1e1
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 24, 2026.

Transparency log

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

Download URL simple_module_inertia-0.0.39-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88442aaa426aa5ffc756c0b871b49a61c66dccc3e753ef02d0ea10b2e906d4e2
BLAKE2b-256 checksum
How to use checksums
723c7970a45f90c652a7f965f6ee1375a885ba33a6554a45ba4f3385b1a50bfd
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 24, 2026.

Transparency log

Security for simple-module-inertia 0.0.39

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.39.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 24, 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