The lightning-fast ASGI server.
Documentation: https://www.uvicorn.org
Requirements: Python 3.6+ (For Python 3.5 support, install version 0.8.6.)
Uvicorn is a lightning-fast ASGI server implementation, using uvloop and httptools.
Until recently Python has lacked a minimal low-level server/application interface for asyncio frameworks. The ASGI specification fills this gap, and means we're now able to start building a common set of tooling usable across all asyncio frameworks.
Uvicorn currently supports HTTP/1.1 and WebSockets. Support for HTTP/2 is planned.
Quickstart
Install using pip:
$ pip install uvicorn
This will install uvicorn with minimal (pure Python) dependencies.
$ pip install uvicorn[standard]
This will install uvicorn with "Cython-based" dependencies (where possible) and other "optional extras".
In this context, "Cython-based" means the following:
- the event loop
uvloopwill be installed and used if possible. - the http protocol will be handled by
httptoolsif possible.
Moreover, "optional extras" means that:
- the websocket protocol will be handled by
websockets(should you want to usewsprotoyou'd need to install it manually) if possible. - the
--reloadflag in development mode will usewatchgod. - windows users will have
coloramainstalled for the colored logs. python-dotenvwill be installed should you want to use the--env-fileoption.PyYAMLwill be installed to allow you to provide a.yamlfile to--log-config, if desired.
Create an application, in example.py:
async def app(scope, receive, send):
assert scope['type'] == 'http'
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
[b'content-type', b'text/plain'],
],
})
await send({
'type': 'http.response.body',
'body': b'Hello, world!',
})
Run the server:
$ uvicorn example:app
Uvicorn is BSD licensed code.
Designed & built in Brighton, England.
— 🦄 —
Release files for uvicorn 0.16.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uvicorn-0.16.0.tar.gz | 39.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uvicorn-0.16.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.3 kB
Release files / uvicorn-0.16.0.tar.gz
| Download URL | uvicorn-0.16.0.tar.gz |
|---|---|
| Size | 39.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eacb66afa65e0648fcbce5e746b135d09722231ffffc61883d4fac2b62fbea8d
|
|
BLAKE2b-256 checksum How to use checksums |
b868bdce2f0775162b3939991765588ae755796af6ecac4f5c3d020a92873dc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|
Release files / uvicorn-0.16.0-py3-none-any.whl
| Download URL | uvicorn-0.16.0-py3-none-any.whl |
|---|---|
| Size | 54.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8c839231f270adaa6d338d525e2652a0b4a5f4c2430b5c4ef6ae4d11776b0d2
|
|
BLAKE2b-256 checksum How to use checksums |
a068effcc7c39d79fbae86ad621ebcf28d63a3b9c111a885bc2b74c576ba8dc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|