Overview

Sanic 25.3, released on March 31, 2025, introduces an enhanced REPL and support for custom objects in the application context.

Main Features

Enhanced REPL

The new interactive REPL lets you inspect the running application, test routes, and execute code within the server context.

python
from sanic import Sanic, json

app = Sanic('MyApp')

@app.get('/')
async def hello(request):
    return json({'message': 'Hello'})

# Launch with REPL: sanic app:app --repl

Custom objects

You can now attach custom objects to the application context via app.ctx, with strong typing.

python
from sanic import Sanic, json
from dataclasses import dataclass

@dataclass
class AppContext:
    db_url: str = 'sqlite:///app.db'

app = Sanic('MyApp', ctx=AppContext())

@app.get('/config')
async def config(request):
    return json({'db': request.app.ctx.db_url})

Sources