---
title: "uvicorn | pypx"
description: "The lightning-fast ASGI server."
canonical_url: "https://pypx.app/packages/uvicorn"
meta:
  "og:description": "The lightning-fast ASGI server."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_uvicorn%2Cversion_0.54.0%2Csummary_The%2Blightning-fast%2BASGI%2Bserver.%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy91dmljb3JuIg%2Cs_fXjUSKAUSXXJQ78D.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "uvicorn 0.54.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_uvicorn%2Cversion_0.54.0%2Csummary_The%2Blightning-fast%2BASGI%2Bserver.%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy91dmljb3JuIg%2Cs_fXjUSKAUSXXJQ78D.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **uvicorn**

v0.54.0

The lightning-fast ASGI server.

85 KB Python 3.10+ py3-none-anyBSD-3-Clause3 deps

[** Diff **](https://pypx.app/packages/uvicorn/diff)

`$ uv add uvicorn`

---

[![Build Status](https://github.com/Kludex/uvicorn/workflows/Test%20Suite/badge.svg)](https://github.com/Kludex/uvicorn/actions) [![Package version](https://badge.fury.io/py/uvicorn.svg)](https://pypi.python.org/pypi/uvicorn) [![Supported Python Version](https://img.shields.io/pypi/pyversions/uvicorn.svg?color=%2334D058)](https://pypi.org/project/uvicorn) [![Discord](https://img.shields.io/discord/1051468649518616576?logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/RxKUF5JuHs)

---

**Documentation**: https://uvicorn.dev

**Source Code**: https://www.github.com/Kludex/uvicorn

---

Uvicorn is an ASGI web server implementation for Python.

Until recently Python has lacked a minimal low-level server/application interface for async frameworks. The [ASGI specification](https://asgi.readthedocs.io/en/latest/) fills this gap, and means we're now able to start building a common set of tooling usable across all async frameworks.

Uvicorn currently supports HTTP/1.1, HTTP/2 and WebSockets.

## 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 `uvloop` will be installed and used if possible.
- the http protocol will be handled by `httptools` if possible.

Moreover, "optional extras" means that:

- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible.
- the `--reload` flag in development mode will use `watchfiles`.
- `python-dotenv` will be installed should you want to use the `--env-file` option.
- `PyYAML` will be installed to allow you to provide a `.yaml` file 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
```

---

## Why ASGI?

Most well established Python Web frameworks started out as WSGI-based frameworks.

WSGI applications are a single, synchronous callable that takes a request and returns a response. This doesn’t allow for long-lived connections, like you get with long-poll HTTP or WebSocket connections, which WSGI doesn't support well.

Having an async concurrency model also allows for options such as lightweight background tasks, and can be less of a limiting factor for endpoints that have long periods being blocked on network I/O such as dealing with slow HTTP requests.

---

## Alternative ASGI servers

A strength of the ASGI protocol is that it decouples the server implementation from the application framework. This allows for an ecosystem of interoperating webservers and application frameworks.

### Daphne

The first ASGI server implementation, originally developed to power Django Channels, is [the Daphne webserver](https://github.com/django/daphne).

It is run widely in production, and supports HTTP/1.1, HTTP/2, and WebSockets.

Any of the example applications given here can equally well be run using `daphne` instead.

```
$ pip install daphne
$ daphne app:App
```

### Hypercorn

[Hypercorn](https://github.com/pgjones/hypercorn) was initially part of the Quart web framework, before being separated out into a standalone ASGI server.

Hypercorn supports HTTP/1.1, HTTP/2, and WebSockets.

It also supports [the excellent `trio` async framework](https://trio.readthedocs.io), as an alternative to `asyncio`.

```
$ pip install hypercorn
$ hypercorn app:App
```

### Mangum

[Mangum](https://github.com/jordaneremieff/mangum) is an adapter for using ASGI applications with AWS Lambda & API Gateway.

### Granian

[Granian](https://github.com/emmett-framework/granian) is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets.

---

## **Details **

<dl>

<dt>Version</dt>
<dd>0.54.0</dd>

<dt>License</dt>
<dd>BSD-3-Clause</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Tom Christie &lt;tom@tomchristie.com&gt;</dd></dl>

## **Links**

- [Changelog](https://uvicorn.dev/release-notes)
- [Funding](https://github.com/sponsors/Kludex)
- [Homepage](https://uvicorn.dev/)
- [Source](https://github.com/Kludex/uvicorn)
- [View on PyPI](https://pypi.org/project/uvicorn/)

## **Release Cadence **

**22**

releases in the past year

avg 17 days between releases

## **Maintainers **

- Tom Christie · [tom@tomchristie.com](mailto:tom@tomchristie.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/uvicorn#webpage","@type":"WebPage","description":"The lightning-fast ASGI server.","name":"uvicorn","url":"https://pypx.app/packages/uvicorn","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/uvicorn"]}]},{"@id":"https://pypx.app/packages/uvicorn#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"The lightning-fast ASGI server.","license":"BSD-3-Clause","name":"uvicorn","softwareVersion":"0.54.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
