Lihil Official
The Official website of python webframework lihil
1from lihil import Lihil23lhl = Lihil()45@lhl.route('/hello/{name}')6async def hello(name: str):7 return {"message": f"Hello, {name}!"}89if __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.
Create a REST API in minutes
from lihil import Lihil, HTTPException, Structlhl = Lihil("todo_api")class TodoItem(Struct):id: inttitle: strcompleted: 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 itemif __name__ == "__main__":lhl.run()
Why Choose lihil?
A clean, powerful Python web framework built for modern apps.
Automatically parse & validate request data from path, query, headers, and body with msgspec – 12x faster and 25x more memory efficient than Pydantic.
Inject dependencies based on type hints. Supports factories, async, scopes, and singletons – all lightning fast.
Handle WebSocket connections with clean, type-safe APIs. Easily test using the built-in WebSocket test client.
Auto-generate OpenAPI docs and problem details. Custom exceptions are turned into clear API responses.
Built-in support for JWT and OAuth2. Auth objects are type-safe and serializable.
Built-in event system to publish and handle events, both in-process and out-of-process, efficiently.
Built-in test client for endpoints, routes, and middlewares – no extra setup required.
Optimized for minimal memory usage. GC overhead is reduced, making services more stable under load.
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.
Ready to build something amazing?
Join the growing community of developers using Lihil to build fast, robust, and scalable web applications.
Get Started Now