{"id":13396919,"url":"https://github.com/encode/uvicorn","last_synced_at":"2025-05-12T16:19:57.581Z","repository":{"id":37451138,"uuid":"92946971","full_name":"encode/uvicorn","owner":"encode","description":"An ASGI web server, for Python. 🦄","archived":false,"fork":false,"pushed_at":"2025-05-01T00:07:45.000Z","size":3586,"stargazers_count":9183,"open_issues_count":65,"forks_count":796,"subscribers_count":94,"default_branch":"master","last_synced_at":"2025-05-05T11:46:29.756Z","etag":null,"topics":["asgi","asyncio","http","http-server","python"],"latest_commit_sha":null,"homepage":"https://www.uvicorn.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/encode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"Kludex"}},"created_at":"2017-05-31T13:13:43.000Z","updated_at":"2025-05-05T08:10:39.000Z","dependencies_parsed_at":"2024-01-16T21:25:02.774Z","dependency_job_id":"382151ea-0095-4335-9e80-32c507604691","html_url":"https://github.com/encode/uvicorn","commit_stats":{"total_commits":1214,"total_committers":198,"mean_commits":"6.1313131313131315","dds":0.6589785831960462,"last_synced_commit":"b7241e1c64b8e10f56191d2836fa386ad3e56681"},"previous_names":[],"tags_count":176,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encode%2Fuvicorn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encode%2Fuvicorn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encode%2Fuvicorn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encode%2Fuvicorn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/encode","download_url":"https://codeload.github.com/encode/uvicorn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252504142,"owners_count":21758654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","asyncio","http","http-server","python"],"created_at":"2024-07-30T18:01:07.739Z","updated_at":"2025-05-05T12:52:35.956Z","avatar_url":"https://github.com/encode.png","language":"Python","funding_links":["https://github.com/sponsors/Kludex"],"categories":["ASGI Servers","资源列表","Python","HarmonyOS","Uncategorized","Servers","ASGI Servers [🔝](#readme)","ASGI服务器","ASGI 服务器","Web框架","Web Frameworks","Http servers","Web Frameworks \u0026 RESTful API"],"sub_categories":["ASGI 服务器","Windows Manager","Uncategorized","More","ASGI Servers"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"320\" height=\"320\" src=\"https://raw.githubusercontent.com/tomchristie/uvicorn/master/docs/uvicorn.png\" alt='uvicorn'\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cem\u003eAn ASGI web server, for Python.\u003c/em\u003e\n\u003c/p\u003e\n\n---\n\n[![Build Status](https://github.com/encode/uvicorn/workflows/Test%20Suite/badge.svg)](https://github.com/encode/uvicorn/actions)\n[![Package version](https://badge.fury.io/py/uvicorn.svg)](https://pypi.python.org/pypi/uvicorn)\n[![Supported Python Version](https://img.shields.io/pypi/pyversions/uvicorn.svg?color=%2334D058)](https://pypi.org/project/uvicorn)\n\n**Documentation**: [https://www.uvicorn.org](https://www.uvicorn.org)\n\n---\n\nUvicorn is an ASGI web server implementation for Python.\n\nUntil recently Python has lacked a minimal low-level server/application interface for\nasync frameworks. The [ASGI specification][asgi] fills this gap, and means we're now able to\nstart building a common set of tooling usable across all async frameworks.\n\nUvicorn supports HTTP/1.1 and WebSockets.\n\n## Quickstart\n\nInstall using `pip`:\n\n```shell\n$ pip install uvicorn\n```\n\nThis will install uvicorn with minimal (pure Python) dependencies.\n\n```shell\n$ pip install 'uvicorn[standard]'\n```\n\nThis will install uvicorn with \"Cython-based\" dependencies (where possible) and other \"optional extras\".\n\nIn this context, \"Cython-based\" means the following:\n\n- the event loop `uvloop` will be installed and used if possible.\n- the http protocol will be handled by `httptools` if possible.\n\nMoreover, \"optional extras\" means that:\n\n- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible.\n- the `--reload` flag in development mode will use `watchfiles`.\n- windows users will have `colorama` installed for the colored logs.\n- `python-dotenv` will be installed should you want to use the `--env-file` option.\n- `PyYAML` will be installed to allow you to provide a `.yaml` file to `--log-config`, if desired.\n\nCreate an application, in `example.py`:\n\n```python\nasync def app(scope, receive, send):\n    assert scope['type'] == 'http'\n\n    await send({\n        'type': 'http.response.start',\n        'status': 200,\n        'headers': [\n            (b'content-type', b'text/plain'),\n        ],\n    })\n    await send({\n        'type': 'http.response.body',\n        'body': b'Hello, world!',\n    })\n```\n\nRun the server:\n\n```shell\n$ uvicorn example:app\n```\n\n---\n\n## Why ASGI?\n\nMost well established Python Web frameworks started out as WSGI-based frameworks.\n\nWSGI applications are a single, synchronous callable that takes a request and returns a response.\nThis doesn’t allow for long-lived connections, like you get with long-poll HTTP or WebSocket connections,\nwhich WSGI doesn't support well.\n\nHaving an async concurrency model also allows for options such as lightweight background tasks,\nand can be less of a limiting factor for endpoints that have long periods being blocked on network\nI/O such as dealing with slow HTTP requests.\n\n---\n\n## Alternative ASGI servers\n\nA strength of the ASGI protocol is that it decouples the server implementation\nfrom the application framework. This allows for an ecosystem of interoperating\nwebservers and application frameworks.\n\n### Daphne\n\nThe first ASGI server implementation, originally developed to power Django Channels, is [the Daphne webserver][daphne].\n\nIt is run widely in production, and supports HTTP/1.1, HTTP/2, and WebSockets.\n\nAny of the example applications given here can equally well be run using `daphne` instead.\n\n```\n$ pip install daphne\n$ daphne app:App\n```\n\n### Hypercorn\n\n[Hypercorn][hypercorn] was initially part of the Quart web framework, before\nbeing separated out into a standalone ASGI server.\n\nHypercorn supports HTTP/1.1, HTTP/2, and WebSockets.\n\nIt also supports [the excellent `trio` async framework][trio], as an alternative to `asyncio`.\n\n```\n$ pip install hypercorn\n$ hypercorn app:App\n```\n\n### Mangum\n\n[Mangum][mangum] is an adapter for using ASGI applications with AWS Lambda \u0026 API Gateway.\n\n### Granian\n\n[Granian][granian] is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets.\n\n---\n\n\u003cp align=\"center\"\u003e\u003ci\u003eUvicorn is \u003ca href=\"https://github.com/encode/uvicorn/blob/master/LICENSE.md\"\u003eBSD licensed\u003c/a\u003e code.\u003cbr/\u003eDesigned \u0026 crafted with care.\u003c/i\u003e\u003cbr/\u003e\u0026mdash; 🦄  \u0026mdash;\u003c/p\u003e\n\n[asgi]: https://asgi.readthedocs.io/en/latest/\n[daphne]: https://github.com/django/daphne\n[hypercorn]: https://github.com/pgjones/hypercorn\n[trio]: https://trio.readthedocs.io\n[mangum]: https://github.com/jordaneremieff/mangum\n[granian]: https://github.com/emmett-framework/granian\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencode%2Fuvicorn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fencode%2Fuvicorn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencode%2Fuvicorn/lists"}