Skip to main content
Performant. Productive. Professional.

Lihil Official

The Official website of python webframework lihil

Get StartedGitHub
example.py
1from lihil import Lihil
2
3lhl = Lihil()
4
5@lhl.route('/hello/{name}')
6async def hello(name: str):
7 return {"message": f"Hello, {name}!"}
8
9if __name__ == "__main__":
10 lhl.run(__file__)

50%-100%

Faster than other ASGI frameworks, more for larger app

100%

Test Covered and strictly typed

> 40K

RPS(per CPU thread)


Get Started in Seconds

Lihil is designed for simplicity without sacrificing power. Install with pip and start building your next Python web application.

$|
Install

Create a REST API in minutes

app.py
from lihil import Lihil, HTTPException, Struct
lhl = Lihil("todo_api")
class TodoItem(Struct):
id: int
title: str
completed: bool = False
@lhl.get("/todos")
async def get_todos():
return todos
@lhl.post("/todos")
async def create_todo(item: TodoItem, todo_repo: TodoRepo):
todo_repo.add(item)
return item
if __name__ == "__main__":
lhl.run()

Why Choose lihil?

A clean, powerful Python web framework built for modern apps.
Param Parsing & Validation

Automatically parse & validate request data from path, query, headers, and body with msgspec – 12x faster and 25x more memory efficient than Pydantic.

Powerful Dependency Injection

Inject dependencies based on type hints. Supports factories, async, scopes, and singletons – all lightning fast.

WebSocket

Handle WebSocket connections with clean, type-safe APIs. Easily test using the built-in WebSocket test client.

OpenAPI & Error Docs

Auto-generate OpenAPI docs and problem details. Custom exceptions are turned into clear API responses.

Authentication & Authorization

Built-in support for JWT and OAuth2. Auth objects are type-safe and serializable.

Message System

Built-in event system to publish and handle events, both in-process and out-of-process, efficiently.

Great Testability

Built-in test client for endpoints, routes, and middlewares – no extra setup required.

Memory efficient

Optimized for minimal memory usage. GC overhead is reduced, making services more stable under load.

AI-Ready

Designed with AI in mind. Built-in support for SSE, MCP, and remote handlers coming soon.


Join the Community

Lihil is backed by a growing community of Python developers. Get support, contribute, and help shape the future of fast Python web development.

GitHubDiscordContribute
Latest Release

Loading...

Release Notes

Ready to build something amazing?

Join the growing community of developers using Lihil to build fast, robust, and scalable web applications.

Get Started Now