graingert / uvicorn

The lightning-fast asyncio server, for Python 3. πŸ¦„

Home Page:http://www.uvicorn.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

β€” πŸ¦„ β€”

About

The lightning-fast asyncio server, for Python 3. πŸ¦„

http://www.uvicorn.org/

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 94.5%Language:HTML 2.8%Language:Shell 2.7%