The lightning-fast asyncio server, for Python 3.
Documentation: http://www.uvicorn.org
Requirements: Python 3.5.3+
Python currently lacks a minimal low-level server/application interface for asyncio frameworks. Filling this gap means we'd be able to start building a common set of tooling usable across all asyncio frameworks.
Uvicorn is an attempt to resolve this, by providing:
- A lightning-fast asyncio server implementation, using uvloop and httptools.
- A minimal application interface, based on ASGI.
It currently supports HTTP, WebSockets, Pub/Sub broadcast, and is open to extension to other protocols & messaging styles.
Install using pip:
$ pip install uvicornCreate an application, in app.py:
async def hello_world(message, channels):
content = b'Hello, world'
response = {
'status': 200,
'headers': [
[b'content-type', b'text/plain'],
],
'content': content
}
await channels['reply'].send(response)Run the server:
$ uvicorn app:hello_worldUvicorn is BSD licensed code.
Designed & built in Brighton, England.
— 🦄 —