MCPcopy
hub / github.com/encode/uvicorn / run

Function run

uvicorn/main.py:495–628  ·  view source on GitHub ↗
(
    app: ASGIApplication | Callable[..., Any] | str,
    *,
    host: str = "127.0.0.1",
    port: int = 8000,
    uds: str | None = None,
    fd: int | None = None,
    loop: LoopFactoryType | str = "auto",
    http: type[asyncio.Protocol] | HTTPProtocolType | str = "auto",
    ws: type[asyncio.Protocol] | WSProtocolType | str = "auto",
    ws_max_size: int = 16777216,
    ws_max_queue: int = 32,
    ws_ping_interval: float | None = 20.0,
    ws_ping_timeout: float | None = 20.0,
    ws_per_message_deflate: bool = True,
    lifespan: LifespanType = "auto",
    interface: InterfaceType = "auto",
    reload: bool = False,
    reload_dirs: list[str] | str | None = None,
    reload_includes: list[str] | str | None = None,
    reload_excludes: list[str] | str | None = None,
    reload_delay: float = 0.25,
    workers: int | None = None,
    env_file: str | os.PathLike[str] | None = None,
    log_config: dict[str, Any] | str | os.PathLike[str] | RawConfigParser | IO[Any] | None = LOGGING_CONFIG,
    log_level: str | int | None = None,
    access_log: bool = True,
    proxy_headers: bool = True,
    server_header: bool = True,
    date_header: bool = True,
    forwarded_allow_ips: list[str] | str | None = None,
    root_path: str = "",
    limit_concurrency: int | None = None,
    backlog: int = 2048,
    limit_max_requests: int | None = None,
    limit_max_requests_jitter: int = 0,
    timeout_keep_alive: int = 5,
    timeout_graceful_shutdown: int | None = None,
    timeout_worker_healthcheck: int = 5,
    ssl_keyfile: str | os.PathLike[str] | None = None,
    ssl_certfile: str | os.PathLike[str] | None = None,
    ssl_keyfile_password: str | None = None,
    ssl_version: int = SSL_PROTOCOL_VERSION,
    ssl_cert_reqs: int = ssl.CERT_NONE,
    ssl_ca_certs: str | os.PathLike[str] | None = None,
    ssl_ciphers: str | None = None,
    ssl_context_factory: Callable[[Config, Callable[[], ssl.SSLContext]], ssl.SSLContext] | None = None,
    headers: list[tuple[str, str]] | None = None,
    use_colors: bool | None = None,
    app_dir: str | None = None,
    factory: bool = False,
    h11_max_incomplete_event_size: int | None = None,
    reset_contextvars: bool = False,
)

Source from the content-addressed store, hash-verified

493
494
495def run(
496 app: ASGIApplication | Callable[..., Any] | str,
497 *,
498 host: str = "127.0.0.1",
499 port: int = 8000,
500 uds: str | None = None,
501 fd: int | None = None,
502 loop: LoopFactoryType | str = "auto",
503 http: type[asyncio.Protocol] | HTTPProtocolType | str = "auto",
504 ws: type[asyncio.Protocol] | WSProtocolType | str = "auto",
505 ws_max_size: int = 16777216,
506 ws_max_queue: int = 32,
507 ws_ping_interval: float | None = 20.0,
508 ws_ping_timeout: float | None = 20.0,
509 ws_per_message_deflate: bool = True,
510 lifespan: LifespanType = "auto",
511 interface: InterfaceType = "auto",
512 reload: bool = False,
513 reload_dirs: list[str] | str | None = None,
514 reload_includes: list[str] | str | None = None,
515 reload_excludes: list[str] | str | None = None,
516 reload_delay: float = 0.25,
517 workers: int | None = None,
518 env_file: str | os.PathLike[str] | None = None,
519 log_config: dict[str, Any] | str | os.PathLike[str] | RawConfigParser | IO[Any] | None = LOGGING_CONFIG,
520 log_level: str | int | None = None,
521 access_log: bool = True,
522 proxy_headers: bool = True,
523 server_header: bool = True,
524 date_header: bool = True,
525 forwarded_allow_ips: list[str] | str | None = None,
526 root_path: str = "",
527 limit_concurrency: int | None = None,
528 backlog: int = 2048,
529 limit_max_requests: int | None = None,
530 limit_max_requests_jitter: int = 0,
531 timeout_keep_alive: int = 5,
532 timeout_graceful_shutdown: int | None = None,
533 timeout_worker_healthcheck: int = 5,
534 ssl_keyfile: str | os.PathLike[str] | None = None,
535 ssl_certfile: str | os.PathLike[str] | None = None,
536 ssl_keyfile_password: str | None = None,
537 ssl_version: int = SSL_PROTOCOL_VERSION,
538 ssl_cert_reqs: int = ssl.CERT_NONE,
539 ssl_ca_certs: str | os.PathLike[str] | None = None,
540 ssl_ciphers: str | None = None,
541 ssl_context_factory: Callable[[Config, Callable[[], ssl.SSLContext]], ssl.SSLContext] | None = None,
542 headers: list[tuple[str, str]] | None = None,
543 use_colors: bool | None = None,
544 app_dir: str | None = None,
545 factory: bool = False,
546 h11_max_incomplete_event_size: int | None = None,
547 reset_contextvars: bool = False,
548) -> None:
549 if app_dir is not None:
550 sys.path.insert(0, app_dir)
551
552 config = Config(

Calls 6

load_appMethod · 0.95
bind_socketMethod · 0.95
runMethod · 0.95
ConfigClass · 0.90
ServerClass · 0.90
MultiprocessClass · 0.90