uvicorn

Deploy Python ASGI applications with Uvicorn. Suitable for running FastAPI in production, configuring an ASGI server, setting up Uvicorn worker processes with Gunicorn, or optimizing Python web server performance.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "uvicorn" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-017df3161053547b6c6848a38e05770c1c66afcda55a6f81a194c10cabfc7b59. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Deploy Python ASGI applications with Uvicorn. Suitable for running FastAPI in production, configuring an ASGI server, setting up Uvicorn worker processes with Gunicorn, or optimizing Python web server performance.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: uvicorn
description: >-
  Deploy Python ASGI apps with Uvicorn. Use when a user asks to run FastAPI
  in production, configure an ASGI server, set up Gunicorn with Uvicorn
  workers, or optimize Python web server performance.
license: Apache-2.0
compatibility: 'Python 3.8+, FastAPI, Starlette, Django ASGI'
metadata:
  author: terminal-skills
  version: 1.0.0
  category: development
  tags:
    - uvicorn
    - asgi
    - fastapi
    - production
    - server

Uvicorn

Overview

Uvicorn is a lightning-fast ASGI server for Python. It's the recommended way to run FastAPI, Starlette, and Django ASGI in production. For multi-core utilization, pair it with Gunicorn as a process manager.

Instructions

Step 1: Development

pip install uvicorn[standard]

# Run with auto-reload
uvicorn app.main:app --reload --port 8000

Step 2: Production with Gunicorn

pip install gunicorn

# Gunicorn manages multiple Uvicorn worker processes
gunicorn app.main:app \
  --workers 4 \                    # CPU cores × 2 + 1
  --worker-class uvicorn.workers.UvicornWorker \
  --bind 0.0.0.0:8000 \
  --timeout 120 \
  --graceful-timeout 30 \
  --access-logfile - \
  --error-logfile -

Step 3: Docker Production

FROM python:3.12-slim
WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Non-root user
RUN adduser --system --uid 1001 app
USER app

# Production command
CMD ["gunicorn", "app.main:app", \
     "--workers", "4", \
     "--worker-class", "uvicorn.workers.UvicornWorker", \
     "--bind", "0.0.0.0:8000", \
     "--timeout", "120"]

Step 4: Programmatic Configuration

# run.py — Uvicorn with programmatic config
import uvicorn

if __name__ == "__main__":
    uvicorn.run(
        "app.main:app",
        host="0.0.0.0",
        port=8000,
        workers=4,
        log_level="info",
        access_log=True,
        proxy_headers=True,        # trust X-Forwarded-* from reverse proxy
        forwarded_allow_ips="*",
    )

Guidelines

  • Development: uvicorn --reload (single process, auto-reload on file changes).
  • Production: gunicorn with UvicornWorker class (multi-process, no reload).
  • Workers formula: (2 × CPU cores) + 1 — e.g., 4 cores → 9 workers.
  • Always use behind a reverse proxy (nginx, Caddy) for TLS termination and static files.
  • Set proxy_headers=True when behind a load balancer to get real client IPs.

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供 Uvicorn 部署 ASGI 应用的完整生产级方案
  • 覆盖 FastAPI、Starlette、Django ASGI 等主流框架
Trigger Precision88/100

Highlights

  • 触发场景描述清晰,涵盖开发、生产、Gunicorn 集成等关键用例
Structure and Standards92/100

Highlights

  • 结构清晰,分步骤指导,含完整端到端示例
  • frontmatter 完整,文档长度适中
Execution Reliability85/100

Areas to improve

  • 生产部署缺少显式确认机制 Reported severity: Minor

    生产环境部署命令直接执行,未要求用户确认,存在误操作风险。

    Recommendation: 建议在执行生产部署前添加交互式确认提示(如输入 y/N)。

Highlights

  • 工具来源明确,参数配置正确
  • 覆盖开发、生产、Docker 等多种部署场景
Evidence Verifiability (mean of the first four)88/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 32, 41, 61

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.