Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
U

uvicorn

> DevOps
Open source

An ASGI web server, for Python.

10.9K stars0 likes0 views
WebsiteGitHub

About

An ASGI web server, for Python.

An ASGI web server, for Python.



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 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:

bash
$ pip install uvicorn

This will install uvicorn with minimal (pure Python) dependencies.

bash
$ 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:

python
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:

bash
$ 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.

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 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, as an alternative to asyncio.

$ pip install hypercorn
$ hypercorn app:App

Mangum

Mangum is an adapter for using ASGI applications with AWS Lambda & API Gateway.

Granian

Granian is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets.


Uvicorn is BSD licensed code.
Designed & crafted with care.

— —

Issues· 107 open

View all issuesOpen on GitHub
  • #2714

    split "standard" packaging extra

    Updated Sep 28, 2026
  • #3149

    --workers N loses TCP_NODELAY: every keep-alive request past the first costs ~43ms on Linux

    Updated Sep 20, 2026
  • #1151

    support @asynccontextmanager app_factory functions

    Updated Sep 19, 2026
  • #2722

    Bug report candidate: Uvicorn drops body with Upgrade: h2c + chunked"

    Updated Sep 16, 2026
  • #2757

    Zero-Downtime restart

    Updated Aug 12, 2026
  • #965

    Support X-Forwarded-Host in proxy-headers

    Updated Aug 6, 2026
  • #2945

    Inconsistent IPv6 dual-stack behavior between single-worker and multi-worker modes

    Updated Jul 18, 2026
  • #1972

    Ctrl+C in terminal broken on windows

    need confirmationwindowsUpdated Jun 18, 2026
  • #527

    Honor gunicorn access log format

    enhancementhelp wanteduser experienceloggingworkers/gunicornUpdated May 12, 2026
  • #2880

    Thread based worker

    Updated Apr 1, 2026

> Tags

Pythonasgiasynciohttphttp-server

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理