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

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.36
File Size Uploaded Provenance
simple_module_inertia-0.0.36.tar.gz 19.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 37.6 kB

Release files / simple_module_inertia-0.0.36.tar.gz

Download URL simple_module_inertia-0.0.36.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28d4cf0cfb564f2fa9e30c8a96791d68fb9836d363ea18da36f4a8ec0b36b2dc
BLAKE2b-256 checksum
How to use checksums
6a7c846245deaf64d65e163cf7e7b37164f5b11e236291382fb8c5f1b0f7593d
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 13, 2026.

Transparency log

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

Download URL simple_module_inertia-0.0.36-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81d925305d36a7fc92576f037e79721b37f99d2d985ae12b9e2f1247025c58c7
BLAKE2b-256 checksum
How to use checksums
74fdfbda96eec653e79dbec21492541f03965f6eb19361c361f4e2e70b2c844e
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 13, 2026.

Transparency log

Security for simple-module-inertia 0.0.36

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.36.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 13, 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