Sanic

25.12.0 · active · verified Fri Apr 10

Sanic is an asynchronous Python 3.10+ web server and web framework designed for high performance. It leverages Python's `async/await` syntax and optionally `uvloop` for blazing-fast I/O. Sanic is ASGI compliant, allowing flexible deployment, and offers a Flask-like API for rapid development. The project is actively maintained by the community, with a frequent release cadence, often monthly, following a YY.MM.PATCH versioning scheme. The current version is 25.12.0.

Warnings

Install

Imports

Quickstart

This minimal Sanic application defines a single GET route at the root path ('/') that returns 'Hello, world.' It demonstrates app initialization, route decoration, explicit asynchronous handler definition, and using a Sanic response object. Run with `python your_app.py` or `sanic your_app:app --debug`.

from sanic import Sanic
from sanic.response import text

app = Sanic("MyHelloWorldApp")

@app.get("/")
async def hello_world(request):
    return text("Hello, world.")

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

view raw JSON →