Sanic

Sanic is a Python web framework built on uvloop that is designed for fast HTTP responses via async/await syntax

Overview

Sanic is an async web framework that is designed for speed and performance

Key Features

Async/Await

from sanic import Sanic
from sanic.response import json

app = Sanic("MyApp")

@app.route("/")
async def test(request):
    return json({"hello": "world"})

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

High Performance

Built on uvloop for maximum performance

WebSocket Support

@app.websocket('/feed')
async def feed(request, ws):
    while True:
        data = 'hello!'
        await ws.send(data)

Installation

pip install sanic

Common Use Cases

Advantages

Disadvantages

Official Documentation

Sanic Documentation

Version Information