Overview

Uvicorn 0.15, released on August 13, 2021, introduces glob-based reload patterns and adds Python 3.10 support.

Main Features

Glob reload

The --reload-include parameter accepts glob patterns to target files that trigger auto-reload.

python
# Reload on .py and .html files
# uvicorn app:app --reload --reload-include '*.html'

import uvicorn

uvicorn.run(
    'app:app',
    reload=True,
    reload_includes=['*.py', '*.html', '*.yaml'],
)

Python 3.10 support

Uvicorn 0.15 officially supports Python 3.10 and its new asyncio features.

python
# Python 3.10 compatible
# match/case can be used in ASGI apps

async def app(scope, receive, send):
    match scope['type']:
        case 'http':
            await send({'type': 'http.response.start',
                        'status': 200,
                        'headers': []})
            await send({'type': 'http.response.body',
                        'body': b'OK'})
        case 'websocket':
            pass  # WebSocket handling

Sources