Skip to content
forked from encode/uvicorn

The lightning-fast asyncio server, for Python 3. 🦄

License

Notifications You must be signed in to change notification settings

graingert/uvicorn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. 🦄

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 94.5%
  • HTML 2.8%
  • Shell 2.7%