uvicorn 0.34.0__py3-none-any.whl → 0.34.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uvicorn/__init__.py +1 -1
- uvicorn/config.py +3 -3
- uvicorn/main.py +19 -6
- uvicorn/middleware/wsgi.py +1 -2
- uvicorn/protocols/websockets/websockets_impl.py +4 -4
- uvicorn/protocols/websockets/wsproto_impl.py +2 -2
- uvicorn/server.py +1 -1
- uvicorn/supervisors/statreload.py +1 -1
- {uvicorn-0.34.0.dist-info → uvicorn-0.34.1.dist-info}/METADATA +5 -4
- {uvicorn-0.34.0.dist-info → uvicorn-0.34.1.dist-info}/RECORD +13 -13
- {uvicorn-0.34.0.dist-info → uvicorn-0.34.1.dist-info}/WHEEL +1 -1
- {uvicorn-0.34.0.dist-info → uvicorn-0.34.1.dist-info}/entry_points.txt +0 -0
- {uvicorn-0.34.0.dist-info → uvicorn-0.34.1.dist-info}/licenses/LICENSE.md +0 -0
uvicorn/__init__.py
CHANGED
uvicorn/config.py
CHANGED
@@ -138,7 +138,7 @@ def resolve_reload_patterns(patterns_list: list[str], directories_list: list[str
|
|
138
138
|
# Special case for the .* pattern, otherwise this would only match
|
139
139
|
# hidden directories which is probably undesired
|
140
140
|
if pattern == ".*":
|
141
|
-
continue # pragma: py-
|
141
|
+
continue # pragma: py-not-linux
|
142
142
|
patterns.append(pattern)
|
143
143
|
if is_dir(Path(pattern)):
|
144
144
|
directories.append(Path(pattern))
|
@@ -280,7 +280,7 @@ class Config:
|
|
280
280
|
|
281
281
|
if (reload_dirs or reload_includes or reload_excludes) and not self.should_reload:
|
282
282
|
logger.warning(
|
283
|
-
"Current configuration will not reload as not all conditions are met,
|
283
|
+
"Current configuration will not reload as not all conditions are met, please refer to documentation."
|
284
284
|
)
|
285
285
|
|
286
286
|
if self.should_reload:
|
@@ -446,7 +446,7 @@ class Config:
|
|
446
446
|
else:
|
447
447
|
if not self.factory:
|
448
448
|
logger.warning(
|
449
|
-
"ASGI app factory detected. Using it,
|
449
|
+
"ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly."
|
450
450
|
)
|
451
451
|
|
452
452
|
if self.interface == "auto":
|
uvicorn/main.py
CHANGED
@@ -6,6 +6,7 @@ import os
|
|
6
6
|
import platform
|
7
7
|
import ssl
|
8
8
|
import sys
|
9
|
+
import warnings
|
9
10
|
from configparser import RawConfigParser
|
10
11
|
from typing import IO, Any, Callable
|
11
12
|
|
@@ -29,7 +30,7 @@ from uvicorn.config import (
|
|
29
30
|
LoopSetupType,
|
30
31
|
WSProtocolType,
|
31
32
|
)
|
32
|
-
from uvicorn.server import Server
|
33
|
+
from uvicorn.server import Server
|
33
34
|
from uvicorn.supervisors import ChangeReload, Multiprocess
|
34
35
|
|
35
36
|
LEVEL_CHOICES = click.Choice(list(LOG_LEVELS.keys()))
|
@@ -81,7 +82,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
81
82
|
"--reload-dir",
|
82
83
|
"reload_dirs",
|
83
84
|
multiple=True,
|
84
|
-
help="Set reload directories explicitly, instead of using the current working
|
85
|
+
help="Set reload directories explicitly, instead of using the current working directory.",
|
85
86
|
type=click.Path(exists=True),
|
86
87
|
)
|
87
88
|
@click.option(
|
@@ -106,7 +107,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
106
107
|
type=float,
|
107
108
|
default=0.25,
|
108
109
|
show_default=True,
|
109
|
-
help="Delay between previous and next check if application needs to be.
|
110
|
+
help="Delay between previous and next check if application needs to be. Defaults to 0.25s.",
|
110
111
|
)
|
111
112
|
@click.option(
|
112
113
|
"--workers",
|
@@ -222,7 +223,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
222
223
|
"--proxy-headers/--no-proxy-headers",
|
223
224
|
is_flag=True,
|
224
225
|
default=True,
|
225
|
-
help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to
|
226
|
+
help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info.",
|
226
227
|
)
|
227
228
|
@click.option(
|
228
229
|
"--server-header/--no-server-header",
|
@@ -255,7 +256,7 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
255
256
|
"--limit-concurrency",
|
256
257
|
type=int,
|
257
258
|
default=None,
|
258
|
-
help="Maximum number of concurrent connections or tasks to allow, before issuing
|
259
|
+
help="Maximum number of concurrent connections or tasks to allow, before issuing HTTP 503 responses.",
|
259
260
|
)
|
260
261
|
@click.option(
|
261
262
|
"--backlog",
|
@@ -565,7 +566,7 @@ def run(
|
|
565
566
|
|
566
567
|
if (config.reload or config.workers > 1) and not isinstance(app, str):
|
567
568
|
logger = logging.getLogger("uvicorn.error")
|
568
|
-
logger.warning("You must pass the application as an import string to enable 'reload' or
|
569
|
+
logger.warning("You must pass the application as an import string to enable 'reload' or 'workers'.")
|
569
570
|
sys.exit(1)
|
570
571
|
|
571
572
|
try:
|
@@ -587,5 +588,17 @@ def run(
|
|
587
588
|
sys.exit(STARTUP_FAILURE)
|
588
589
|
|
589
590
|
|
591
|
+
def __getattr__(name: str) -> Any:
|
592
|
+
if name == "ServerState":
|
593
|
+
warnings.warn(
|
594
|
+
"uvicorn.main.ServerState is deprecated, use uvicorn.server.ServerState instead.",
|
595
|
+
DeprecationWarning,
|
596
|
+
)
|
597
|
+
from uvicorn.server import ServerState
|
598
|
+
|
599
|
+
return ServerState
|
600
|
+
raise AttributeError(f"module {__name__} has no attribute {name}")
|
601
|
+
|
602
|
+
|
590
603
|
if __name__ == "__main__":
|
591
604
|
main() # pragma: no cover
|
uvicorn/middleware/wsgi.py
CHANGED
@@ -82,8 +82,7 @@ def build_environ(scope: HTTPScope, message: ASGIReceiveEvent, body: io.BytesIO)
|
|
82
82
|
class _WSGIMiddleware:
|
83
83
|
def __init__(self, app: WSGIApp, workers: int = 10):
|
84
84
|
warnings.warn(
|
85
|
-
"Uvicorn's native WSGI implementation is deprecated, you "
|
86
|
-
"should switch to a2wsgi (`pip install a2wsgi`).",
|
85
|
+
"Uvicorn's native WSGI implementation is deprecated, you should switch to a2wsgi (`pip install a2wsgi`).",
|
87
86
|
DeprecationWarning,
|
88
87
|
)
|
89
88
|
self.app = app
|
@@ -214,7 +214,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|
214
214
|
def send_500_response(self) -> None:
|
215
215
|
msg = b"Internal Server Error"
|
216
216
|
content = [
|
217
|
-
b"HTTP/1.1 500 Internal Server Error\r\
|
217
|
+
b"HTTP/1.1 500 Internal Server Error\r\ncontent-type: text/plain; charset=utf-8\r\n",
|
218
218
|
b"content-length: " + str(len(msg)).encode("ascii") + b"\r\n",
|
219
219
|
b"connection: close\r\n",
|
220
220
|
b"\r\n",
|
@@ -338,7 +338,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|
338
338
|
self.closed_event.set()
|
339
339
|
|
340
340
|
else:
|
341
|
-
msg = "Expected ASGI message 'websocket.send' or 'websocket.close',
|
341
|
+
msg = "Expected ASGI message 'websocket.send' or 'websocket.close', but got '%s'."
|
342
342
|
raise RuntimeError(msg % message_type)
|
343
343
|
except ConnectionClosed as exc:
|
344
344
|
raise ClientDisconnected from exc
|
@@ -351,11 +351,11 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|
351
351
|
if not message.get("more_body", False):
|
352
352
|
self.closed_event.set()
|
353
353
|
else:
|
354
|
-
msg = "Expected ASGI message 'websocket.http.response.body'
|
354
|
+
msg = "Expected ASGI message 'websocket.http.response.body' but got '%s'."
|
355
355
|
raise RuntimeError(msg % message_type)
|
356
356
|
|
357
357
|
else:
|
358
|
-
msg = "Unexpected ASGI message '%s', after sending 'websocket.close'
|
358
|
+
msg = "Unexpected ASGI message '%s', after sending 'websocket.close' or response already completed."
|
359
359
|
raise RuntimeError(msg % message_type)
|
360
360
|
|
361
361
|
async def asgi_receive(self) -> WebSocketDisconnectEvent | WebSocketConnectEvent | WebSocketReceiveEvent:
|
@@ -344,7 +344,7 @@ class WSProtocol(asyncio.Protocol):
|
|
344
344
|
self.transport.close()
|
345
345
|
|
346
346
|
else:
|
347
|
-
msg = "Expected ASGI message 'websocket.send' or 'websocket.close',
|
347
|
+
msg = "Expected ASGI message 'websocket.send' or 'websocket.close', but got '%s'."
|
348
348
|
raise RuntimeError(msg % message_type)
|
349
349
|
except LocalProtocolError as exc:
|
350
350
|
raise ClientDisconnected from exc
|
@@ -362,7 +362,7 @@ class WSProtocol(asyncio.Protocol):
|
|
362
362
|
self.transport.close()
|
363
363
|
|
364
364
|
else:
|
365
|
-
msg = "Expected ASGI message 'websocket.http.response.body'
|
365
|
+
msg = "Expected ASGI message 'websocket.http.response.body' but got '%s'."
|
366
366
|
raise RuntimeError(msg % message_type)
|
367
367
|
|
368
368
|
else:
|
uvicorn/server.py
CHANGED
@@ -119,7 +119,7 @@ class Server:
|
|
119
119
|
|
120
120
|
def _share_socket(
|
121
121
|
sock: socket.SocketType,
|
122
|
-
) -> socket.SocketType: # pragma py-
|
122
|
+
) -> socket.SocketType: # pragma py-not-win32
|
123
123
|
# Windows requires the socket be explicitly shared across
|
124
124
|
# multiple workers (processes).
|
125
125
|
from socket import fromshare # type: ignore[attr-defined]
|
@@ -24,7 +24,7 @@ class StatReload(BaseReload):
|
|
24
24
|
self.mtimes: dict[Path, float] = {}
|
25
25
|
|
26
26
|
if config.reload_excludes or config.reload_includes:
|
27
|
-
logger.warning("--reload-include and --reload-exclude have no effect unless
|
27
|
+
logger.warning("--reload-include and --reload-exclude have no effect unless watchfiles is installed.")
|
28
28
|
|
29
29
|
def should_restart(self) -> list[Path] | None:
|
30
30
|
self.pause()
|
@@ -1,13 +1,14 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: uvicorn
|
3
|
-
Version: 0.34.
|
3
|
+
Version: 0.34.1
|
4
4
|
Summary: The lightning-fast ASGI server.
|
5
|
-
Project-URL: Changelog, https://
|
5
|
+
Project-URL: Changelog, https://www.uvicorn.org/release-notes
|
6
6
|
Project-URL: Funding, https://github.com/sponsors/encode
|
7
7
|
Project-URL: Homepage, https://www.uvicorn.org/
|
8
8
|
Project-URL: Source, https://github.com/encode/uvicorn
|
9
9
|
Author-email: Tom Christie <tom@tomchristie.com>, Marcelo Trylesinski <marcelotryle@gmail.com>
|
10
|
-
License: BSD-3-Clause
|
10
|
+
License-Expression: BSD-3-Clause
|
11
|
+
License-File: LICENSE.md
|
11
12
|
Classifier: Development Status :: 4 - Beta
|
12
13
|
Classifier: Environment :: Web Environment
|
13
14
|
Classifier: Intended Audience :: Developers
|
@@ -1,13 +1,13 @@
|
|
1
|
-
uvicorn/__init__.py,sha256=
|
1
|
+
uvicorn/__init__.py,sha256=SXztotDlDwRpwhxNAxosheuUoUmf8R6AKtYW5NiOToE,147
|
2
2
|
uvicorn/__main__.py,sha256=DQizy6nKP0ywhPpnCHgmRDYIMfcqZKVEzNIWQZjqtVQ,62
|
3
3
|
uvicorn/_subprocess.py,sha256=HbfRnsCkXyg7xCWVAWWzXQTeWlvLKfTlIF5wevFBkR4,2766
|
4
4
|
uvicorn/_types.py,sha256=5FcPvvIfeKsJDjGhTrceDv8TmwzYI8yPF7mXsXTWOUM,7775
|
5
|
-
uvicorn/config.py,sha256=
|
5
|
+
uvicorn/config.py,sha256=zg-UX2vu3Zy0e7jXOJKoY1mPhsbIuq-3IwwKy9yERkg,20894
|
6
6
|
uvicorn/importer.py,sha256=nRt0QQ3qpi264-n_mR0l55C2ddM8nowTNzT1jsWaam8,1128
|
7
7
|
uvicorn/logging.py,sha256=-eCE4nOJmFbtB9qfNJuEVNF0Y13LGUHqvFzemYT0PaQ,4235
|
8
|
-
uvicorn/main.py,sha256=
|
8
|
+
uvicorn/main.py,sha256=5TFzub2UbSk4LOQ_UeQ3PZLiTRG51KIQ0sSY9SZUMN8,17234
|
9
9
|
uvicorn/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
10
|
-
uvicorn/server.py,sha256=
|
10
|
+
uvicorn/server.py,sha256=Kd2S0UarzwJyt9YHZzTghMPxxRVa1zIVA8Cqy6AuT9A,12879
|
11
11
|
uvicorn/workers.py,sha256=7KGgGAapxGkGeXUcBGunOjSNdI9R44KCoWTGEAqAdfs,3895
|
12
12
|
uvicorn/lifespan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
uvicorn/lifespan/off.py,sha256=nfI6qHAUo_8-BEXMBKoHQ9wUbsXrPaXLCbDSS0vKSr8,332
|
@@ -20,7 +20,7 @@ uvicorn/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
20
20
|
uvicorn/middleware/asgi2.py,sha256=YQrQNm3RehFts3mzk3k4yw8aD8Egtj0tRS3N45YkQa0,394
|
21
21
|
uvicorn/middleware/message_logger.py,sha256=IHEZUSnFNaMFUFdwtZO3AuFATnYcSor-gVtOjbCzt8M,2859
|
22
22
|
uvicorn/middleware/proxy_headers.py,sha256=f1VDAc-ipPHdNTuLNHwYCeDgYXoCL_VjD6hDTUXZT_U,5790
|
23
|
-
uvicorn/middleware/wsgi.py,sha256=
|
23
|
+
uvicorn/middleware/wsgi.py,sha256=N6fWyOnHoeHbUevX0mDYFNmI4lsMv7Y0qnd7Y3fJVL4,7105
|
24
24
|
uvicorn/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
uvicorn/protocols/utils.py,sha256=rCjYLd4_uwPeZkbRXQ6beCfxyI_oYpvJCwz3jEGNOiE,1849
|
26
26
|
uvicorn/protocols/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -30,15 +30,15 @@ uvicorn/protocols/http/h11_impl.py,sha256=4b-KswK57FBaRPeHXlK_oy8pKM6vG1haALCIeR
|
|
30
30
|
uvicorn/protocols/http/httptools_impl.py,sha256=tuQBCiD6rf5DQeyQwHVc45rxH9ouojMpkXi9KG6NRBk,21805
|
31
31
|
uvicorn/protocols/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
uvicorn/protocols/websockets/auto.py,sha256=kNP-h07ZzjA9dKRUd7MNO0J7xhRJ5xVBfit7wCbdB0A,574
|
33
|
-
uvicorn/protocols/websockets/websockets_impl.py,sha256=
|
34
|
-
uvicorn/protocols/websockets/wsproto_impl.py,sha256=
|
33
|
+
uvicorn/protocols/websockets/websockets_impl.py,sha256=E0e7aX4ICmSIuytfc4d5RhWvjH37Ed8ZgXwAH2f8oog,15504
|
34
|
+
uvicorn/protocols/websockets/wsproto_impl.py,sha256=2OB4E6OsQ1KPiETkHYi2UQDxY9sUzTr0LLZQJxlXPxo,15375
|
35
35
|
uvicorn/supervisors/__init__.py,sha256=wT8eOEIqT1yWQgytZtv5taWMul7xoTIY0xm1m4oyPTw,507
|
36
36
|
uvicorn/supervisors/basereload.py,sha256=arOe3PqQp0L5FvCYDsVg8jUev-57syWFzHhggsM18VY,3858
|
37
37
|
uvicorn/supervisors/multiprocess.py,sha256=Opt0XvOUj1DIMXYwb4OlkJZxeh_RjweFnTmDPYItONw,7507
|
38
|
-
uvicorn/supervisors/statreload.py,sha256=
|
38
|
+
uvicorn/supervisors/statreload.py,sha256=uYblmoxM3IbPbvMDzr5Abw2-WykQl8NxTTzeLfVyvnU,1566
|
39
39
|
uvicorn/supervisors/watchfilesreload.py,sha256=41FGNMXPKrKvPr-5O8yRWg43l6OCBtapt39M-gpdk0E,3010
|
40
|
-
uvicorn-0.34.
|
41
|
-
uvicorn-0.34.
|
42
|
-
uvicorn-0.34.
|
43
|
-
uvicorn-0.34.
|
44
|
-
uvicorn-0.34.
|
40
|
+
uvicorn-0.34.1.dist-info/METADATA,sha256=O2eY1scXzGrYzwSaRblLDbHpkBnzhrLXZ1AFsm6xmlw,6549
|
41
|
+
uvicorn-0.34.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
42
|
+
uvicorn-0.34.1.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
|
43
|
+
uvicorn-0.34.1.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
|
44
|
+
uvicorn-0.34.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|