Overview

Sanic 23.12, released on December 31, 2023, adds Python 3.12 support and introduces dependency injection.

Main Features

Dependency injection lets you declare handler parameters and have them resolved automatically at runtime.

python
from sanic import Sanic, json

app = Sanic('MyApp')

@app.get('/')
async def handler(request):
    return json({'version': '23.12'})

Sources