jero
A high-performance, msgspec-first ASGI framework for modern Python.
- Python
- ASGI
- msgspec
- Granian
The boundary should be the clearest part
Web frameworks often make the first endpoint effortless, then collect hidden complexity as an application grows. Runtime dependency graphs become difficult to inspect. Decorators scatter routing information. Validation happens only after a request reaches production.
jero makes the application boundary explicit, typed, and fully validated before serving traffic.
uv add jero
Install it from PyPI.
Published performance results: jero was the fastest Python framework tested across all four benchmark scenarios. The complete methodology, configuration, caveats, and results are published alongside the project.
A type system with runtime consequences
Type hints are not documentation pasted beside the API. They are the API contract. jero uses msgspec to turn those contracts into fast request decoding and response encoding, while preserving a direct correspondence between the code an engineer reads and the data the application accepts.
from msgspec import Struct
from jero import BaseApp, Resource
class WidgetPath(Struct):
widget_id: str
class Widget(Struct):
id: str
name: str
class WidgetResource(Resource, path="/widgets"):
async def read_one(self, path: WidgetPath) -> Widget:
return Widget(id=path.widget_id, name="widget-name")
class App(BaseApp):
async def wire(self) -> None:
self.include_resource(WidgetResource())
app = App()
This model makes path binding and response bodies visible at the call site. Invalid or ambiguous wiring is rejected during startup rather than discovered under load.
Explicit wiring
BaseApp, Resource, and Endpoint form the structural vocabulary. Resources are
included deliberately, and wire() resolves the final application graph. There is no
traditional dependency-injection container and no ambient registry doing invisible
work.
That creates some repetition, but it also gives the application a shape that can be inspected, tested, and reasoned about without reconstructing framework state.
Performance without code golf
msgspec provides efficient structured data handling, while ASGI keeps the runtime boundary small and composable. jero is intended to run with a high-performance server such as Granian. Its request path is deliberately small: route lookup, msgspec decode, handler call, and encode. Published benchmarks and their methodology are available in the project documentation.
The trade-off
Class-based routing is opinionated. Teams who prefer free-form functions or decorator-driven discovery may find the structure restrictive. jero accepts that cost to gain consistent lifecycle hooks, localised routing behaviour, and stronger startup checks. It is a framework for teams that value a stable mental model over maximal surface-area flexibility.