ASGI¶
Using Piccolo standalone is fine if you want to build a data science script, but often you’ll want to build a web application around it.
ASGI is a standardised way for async Python libraries to interoperate. It’s the equivalent of WSGI in the synchronous world.
By using the piccolo asgi new
command, Piccolo will scaffold an ASGI web
app for you, which includes everything you need to get started. The command
will ask for your preferences on which libraries to use.
Routing frameworks¶
Currently, Starlette, FastAPI, BlackSheep, Litestar, Esmerald and Lilya are supported.
Other great ASGI routing frameworks exist, and may be supported in the future (Quart , Sanic , Django etc).
Which to use?¶
All are great choices. FastAPI is built on top of Starlette and Esmerald is built on top of Lilya, so they’re very similar. FastAPI, BlackSheep and Esmerald are great if you want to document a REST API, as they have built-in OpenAPI support.
Web servers¶
Hypercorn and Uvicorn are available as ASGI servers. Daphne can’t be used programatically so was omitted at this time.