Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 1.98 KB

README.md

File metadata and controls

66 lines (47 loc) · 1.98 KB

uvicorn

The lightning-fast asyncio server, for Python 3.


Build Status Package version Python versions

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.

Quickstart

Install using pip:

$ pip install uvicorn

Create 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_world

Uvicorn is BSD licensed code.
Designed & built in Brighton, England.

— 🦄 —