Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By getludicMITIn 1 marketplace
Builds server-rendered HTML as typed Python components, with the type checker flagging invalid markup before a page renders. Needs Python 3.14+ for t-strings (Ludic 0.5.x covers older versions) and works with Starlette, FastAPI or Django.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Documentation: https://getludic.dev/docs/
Ludic lets you write HTML as typed Python components. Your type checker validates the markup, so wrong nesting, unknown attributes and missing arguments are caught before a page ever renders. At its core Ludic only renders HTML, so it fits into the web framework you already use, and it pairs naturally with htmx.
from typing import override
from ludic import Attrs, Component
from ludic.html import a, b, p
class LinkAttrs(Attrs):
to: str
class Link(Component[str, LinkAttrs]):
@override
def render(self) -> a:
return a(*self.children, href=self.attrs["to"])
p(t"Hello {b('Stranger')}! Click {Link('here', to='/home')}.").to_html()
# <p>Hello <b>Stranger</b>! Click <a href="/home">here</a>.</p>
Invalid markup is a type error. This is what mypy reports:
br("Hello, World!")
# error: Argument 1 to "br" has incompatible type "str"; expected "Never"
html(body())
# error: Argument 1 to "html" has incompatible type "body"; expected "head"
div("Test", href="test")
# error: Unexpected keyword argument "href" for "div"
Link("here", too="/home")
# error: Unexpected keyword argument "too" for "Link"; did you mean "to"?
Link(div("here"), to="/home")
# error: Argument 1 to "Link" has incompatible type "div"; expected "str"
Link("here")
# error: Missing named argument "to" for "Link"
"I've just composed my first PageLayout component and I have no words!"
– Igor Davydenko
SafeLudic 1.x requires Python 3.14+ for t-string support. If you are on Python 3.12 or 3.13, use Ludic 0.5.x, which uses f-strings instead.
The core package renders HTML and has a single dependency:
pip install ludic
To also get the Starlette based web framework, form parsing and code highlighting:
pip install "ludic[full]"
You can also use a basic cookiecutter template to get started quickly. With UV, you need to run only one command:
uvx cookiecutter gh:getludic/template
Elements from ludic.html are checked by plain type hints, so mypy and pyright (and Pylance in VS Code) report the errors above, except those about component attributes. To also check the attributes of your own components, enable the mypy plugin in pyproject.toml:
[tool.mypy]
plugins = ["ludic.mypy_plugin"]
mypy supports t-strings since version 2.0. Older versions report every t-string as an error.
Ludic does not enforce any frontend or backend framework. Pick the integration that matches your stack:
Starlette – LudicApp is a thin wrapper around Starlette, handlers return elements directly:
from ludic.html import b, p
from ludic.web import LudicApp
app = LudicApp()
@app.get("/")
async def homepage() -> p:
return p(t"Hello {b('Stranger')}!")
FastAPI – set the route class and return elements from your endpoints:
from fastapi import FastAPI
from ludic.contrib.fastapi import LudicRoute
from ludic.html import p
app = FastAPI()
app.router.route_class = LudicRoute
@app.get("/")
async def homepage() -> p:
return p("Hello, World!")
Django – wrap the element in a response:
from django.http import HttpRequest
from ludic.contrib.django import LudicResponse
from ludic.html import p
def index(request: HttpRequest) -> LudicResponse:
return LudicResponse(p("Hello, World!"))
7-day copy clicks
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground