From a362f9ff3a5bc717bc301aace3ab29594ec80b40 Mon Sep 17 00:00:00 2001 From: Ryan McCaffrey Date: Wed, 15 Nov 2023 12:05:57 -0500 Subject: [PATCH 1/5] fix[docs]: specify units and defaults for ws_* args in docs --- docs/deployment.md | 4 ++-- docs/index.md | 4 ++-- docs/settings.md | 4 ++-- uvicorn/main.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 6826db8c5..2e4eec813 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -67,8 +67,8 @@ Options: [default: 16777216] --ws-max-queue INTEGER The maximum length of the WebSocket message queue. [default: 32] - --ws-ping-interval FLOAT WebSocket ping interval [default: 20.0] - --ws-ping-timeout FLOAT WebSocket ping timeout [default: 20.0] + --ws-ping-interval FLOAT WebSocket ping interval, in seconds [default: 20.0] + --ws-ping-timeout FLOAT WebSocket ping timeout, in seconds [default: 20.0] --ws-per-message-deflate BOOLEAN WebSocket per-message-deflate compression [default: True] diff --git a/docs/index.md b/docs/index.md index 027e6cc28..f0748ed06 100644 --- a/docs/index.md +++ b/docs/index.md @@ -137,8 +137,8 @@ Options: [default: 16777216] --ws-max-queue INTEGER The maximum length of the WebSocket message queue. [default: 32] - --ws-ping-interval FLOAT WebSocket ping interval [default: 20.0] - --ws-ping-timeout FLOAT WebSocket ping timeout [default: 20.0] + --ws-ping-interval FLOAT WebSocket ping interval, in seconds [default: 20.0] + --ws-ping-timeout FLOAT WebSocket ping timeout, in seconds [default: 20.0] --ws-per-message-deflate BOOLEAN WebSocket per-message-deflate compression [default: True] diff --git a/docs/settings.md b/docs/settings.md index ed4bef52d..9c62460fe 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -70,8 +70,8 @@ Using Uvicorn with watchfiles will enable the following options (which are other * `--ws ` - Set the WebSockets protocol implementation. Either of the `websockets` and `wsproto` packages are supported. Use `'none'` to ignore all websocket requests. **Options:** *'auto', 'none', 'websockets', 'wsproto'.* **Default:** *'auto'*. * `--ws-max-size ` - Set the WebSockets max message size, in bytes. Please note that this can be used only with the default `websockets` protocol. * `--ws-max-queue ` - Set the maximum length of the WebSocket incoming message queue. Please note that this can be used only with the default `websockets` protocol. -* `--ws-ping-interval ` - Set the WebSockets ping interval, in seconds. Please note that this can be used only with the default `websockets` protocol. -* `--ws-ping-timeout ` - Set the WebSockets ping timeout, in seconds. Please note that this can be used only with the default `websockets` protocol. +* `--ws-ping-interval ` - Set the WebSockets ping interval, in seconds. Please note that this can be used only with the default `websockets` protocol. **Default:** *20.0* +* `--ws-ping-timeout ` - Set the WebSockets ping timeout, in seconds. Please note that this can be used only with the default `websockets` protocol. **Default:** *20.0* * `--lifespan ` - Set the Lifespan protocol implementation. **Options:** *'auto', 'on', 'off'.* **Default:** *'auto'*. * `--h11-max-incomplete-event-size ` - Set the maximum number of bytes to buffer of an incomplete event. Only available for `h11` HTTP protocol implementation. **Default:** *'16384'* (16 KB). diff --git a/uvicorn/main.py b/uvicorn/main.py index 4e4da6aa9..ca793c5bb 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -8,7 +8,6 @@ import click -import uvicorn from uvicorn._types import ASGIApplication from uvicorn.config import ( HTTP_PROTOCOLS, @@ -28,6 +27,7 @@ ) from uvicorn.server import Server, ServerState # noqa: F401 # Used to be defined here. from uvicorn.supervisors import ChangeReload, Multiprocess +import uvicorn LEVEL_CHOICES = click.Choice(list(LOG_LEVELS.keys())) HTTP_CHOICES = click.Choice(list(HTTP_PROTOCOLS.keys())) @@ -156,14 +156,14 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No "--ws-ping-interval", type=float, default=20.0, - help="WebSocket ping interval", + help="WebSocket ping interval, in seconds", show_default=True, ) @click.option( "--ws-ping-timeout", type=float, default=20.0, - help="WebSocket ping timeout", + help="WebSocket ping timeout, in seconds", show_default=True, ) @click.option( From acf84ea930a8946c817fd1087c3d702550563a84 Mon Sep 17 00:00:00 2001 From: Ryan McCaffrey Date: Thu, 16 Nov 2023 09:21:31 -0500 Subject: [PATCH 2/5] Update uvicorn/main.py Co-authored-by: Marcelo Trylesinski --- uvicorn/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/main.py b/uvicorn/main.py index ca793c5bb..8779cbc47 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -156,7 +156,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No "--ws-ping-interval", type=float, default=20.0, - help="WebSocket ping interval, in seconds", + help="WebSocket ping interval in seconds.", show_default=True, ) @click.option( From d415cb724fb9391807f59b6ad4502d93a78da3d2 Mon Sep 17 00:00:00 2001 From: Ryan McCaffrey Date: Thu, 16 Nov 2023 09:21:36 -0500 Subject: [PATCH 3/5] Update uvicorn/main.py Co-authored-by: Marcelo Trylesinski --- uvicorn/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/main.py b/uvicorn/main.py index 8779cbc47..5092b2cf6 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -163,7 +163,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No "--ws-ping-timeout", type=float, default=20.0, - help="WebSocket ping timeout, in seconds", + help="WebSocket ping timeout in seconds.", show_default=True, ) @click.option( From 7180d65deb35c9f0daf3dc9429dc17ab8120180e Mon Sep 17 00:00:00 2001 From: Ryan McCaffrey Date: Thu, 16 Nov 2023 09:32:52 -0500 Subject: [PATCH 4/5] import reodering --- uvicorn/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/main.py b/uvicorn/main.py index 5092b2cf6..38d18207a 100644 --- a/uvicorn/main.py +++ b/uvicorn/main.py @@ -8,6 +8,7 @@ import click +import uvicorn from uvicorn._types import ASGIApplication from uvicorn.config import ( HTTP_PROTOCOLS, @@ -27,7 +28,6 @@ ) from uvicorn.server import Server, ServerState # noqa: F401 # Used to be defined here. from uvicorn.supervisors import ChangeReload, Multiprocess -import uvicorn LEVEL_CHOICES = click.Choice(list(LOG_LEVELS.keys())) HTTP_CHOICES = click.Choice(list(HTTP_PROTOCOLS.keys())) From 2b6938dce57c1e9420efe0bad508c537c2b65ad5 Mon Sep 17 00:00:00 2001 From: Ryan McCaffrey Date: Thu, 16 Nov 2023 10:01:57 -0500 Subject: [PATCH 5/5] run the linter --- docs/deployment.md | 6 ++++-- docs/index.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 2e4eec813..58927d95e 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -67,8 +67,10 @@ Options: [default: 16777216] --ws-max-queue INTEGER The maximum length of the WebSocket message queue. [default: 32] - --ws-ping-interval FLOAT WebSocket ping interval, in seconds [default: 20.0] - --ws-ping-timeout FLOAT WebSocket ping timeout, in seconds [default: 20.0] + --ws-ping-interval FLOAT WebSocket ping interval in seconds. + [default: 20.0] + --ws-ping-timeout FLOAT WebSocket ping timeout in seconds. + [default: 20.0] --ws-per-message-deflate BOOLEAN WebSocket per-message-deflate compression [default: True] diff --git a/docs/index.md b/docs/index.md index f0748ed06..a129e7a52 100644 --- a/docs/index.md +++ b/docs/index.md @@ -137,8 +137,10 @@ Options: [default: 16777216] --ws-max-queue INTEGER The maximum length of the WebSocket message queue. [default: 32] - --ws-ping-interval FLOAT WebSocket ping interval, in seconds [default: 20.0] - --ws-ping-timeout FLOAT WebSocket ping timeout, in seconds [default: 20.0] + --ws-ping-interval FLOAT WebSocket ping interval in seconds. + [default: 20.0] + --ws-ping-timeout FLOAT WebSocket ping timeout in seconds. + [default: 20.0] --ws-per-message-deflate BOOLEAN WebSocket per-message-deflate compression [default: True]