{"id":17030021,"url":"https://github.com/alvarobartt/uvicorn-context-manager","last_synced_at":"2026-07-02T10:32:31.576Z","repository":{"id":138638920,"uuid":"600551385","full_name":"alvarobartt/uvicorn-context-manager","owner":"alvarobartt","description":"🚀 Context Manager to run `uvicorn` ASGI applications","archived":false,"fork":false,"pushed_at":"2023-02-19T19:14:26.000Z","size":529,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T19:39:57.400Z","etag":null,"topics":["asgi-server","context-manager","uvicorn"],"latest_commit_sha":null,"homepage":"https://alvarobartt.github.io/uvicorn-context-manager/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alvarobartt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"alvarobartt"}},"created_at":"2023-02-11T20:53:16.000Z","updated_at":"2023-04-15T23:12:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"1650bdc9-f4de-4c1a-b13c-9ed98f268480","html_url":"https://github.com/alvarobartt/uvicorn-context-manager","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":"alvarobartt/python-package-template","purl":"pkg:github/alvarobartt/uvicorn-context-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fuvicorn-context-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fuvicorn-context-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fuvicorn-context-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fuvicorn-context-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvarobartt","download_url":"https://codeload.github.com/alvarobartt/uvicorn-context-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarobartt%2Fuvicorn-context-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35043933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-server","context-manager","uvicorn"],"created_at":"2024-10-14T08:03:31.795Z","updated_at":"2026-07-02T10:32:31.560Z","avatar_url":"https://github.com/alvarobartt.png","language":"Python","funding_links":["https://github.com/sponsors/alvarobartt"],"categories":[],"sub_categories":[],"readme":"# 🚀 Context Manager to run `uvicorn` ASGI applications\n\n`uvicorn_context_manager` is a Python package that exposes a class named\n`UvicornContextManager` that inherits from `uvicorn.Server` and\ncontains a Python context manager to deploy an ASGI application inside a context\nand then gracefully shut it down.\n\nThe motivation was to provide a way to easily deploy an ASGI application\nwhen running tests or wanting to interact temporarily with ASGI applications.\n\nThis could have been a GitHub Gist or just a code snippet, but I think that \nthis can be useful for many `uvicorn` users, and it just contains the `uvicorn`\ndependency so there's no overhead.\n\n## ⚒️ Installation\n\nPython greater than 3.7 and lower than 3.11\n\n```bash\npip install uvicorn_context_manager\n```\n\nOr install it in development mode as:\n\n```bash\npip install -e .\n```\n\n## 👨🏻‍💻 Usage\n\n### ⚡️ With `fastapi`\n\nAs mentioned before, the context manager as `uvicorn`, lets you deploy any\nASGI application. Since `fastapi` is one of the most used Python frameworks for \nweb development according to a JetBrains survey, see https://twitter.com/tiangolo/status/1624002347776065538.\n\nSo on, we think it's useful to showcase how to use `uvicorn_context_manager` with\n`fastapi`.\n\n```bash\npip install fastapi\n```\n\nOnce installed, you can deploy your ASGI application in a Python context manager as:\n\n```python\nfrom fastapi import FastAPI\nfrom uvicorn_context_manager import UvicornContextManager\n\napi = FastAPI()\nwith UvicornContextManager(api) as server:\n    ...\n```\n\n## 🥇 Credits\n\nCredits go to [@florimondmanca](https://github.com/florimondmanca) due to the\nsolution provided at [encode/uvicorn#1103](https://github.com/encode/uvicorn/discussions/1103#discussioncomment-941726),\nas the motivation to create this package was based on that code snippet.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarobartt%2Fuvicorn-context-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvarobartt%2Fuvicorn-context-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarobartt%2Fuvicorn-context-manager/lists"}