uvicorn 0.33.0__py3-none-any.whl → 0.34.0__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 CHANGED
@@ -1,5 +1,5 @@
1
1
  from uvicorn.config import Config
2
2
  from uvicorn.main import Server, main, run
3
3
 
4
- __version__ = "0.33.0"
4
+ __version__ = "0.34.0"
5
5
  __all__ = ["main", "run", "Config", "Server"]
uvicorn/_types.py CHANGED
@@ -32,20 +32,8 @@ from __future__ import annotations
32
32
 
33
33
  import sys
34
34
  import types
35
- from typing import (
36
- Any,
37
- Awaitable,
38
- Callable,
39
- Iterable,
40
- Literal,
41
- MutableMapping,
42
- Optional,
43
- Protocol,
44
- Tuple,
45
- Type,
46
- TypedDict,
47
- Union,
48
- )
35
+ from collections.abc import Awaitable, Iterable, MutableMapping
36
+ from typing import Any, Callable, Literal, Optional, Protocol, TypedDict, Union
49
37
 
50
38
  if sys.version_info >= (3, 11): # pragma: py-lt-311
51
39
  from typing import NotRequired
@@ -54,8 +42,8 @@ else: # pragma: py-gte-311
54
42
 
55
43
  # WSGI
56
44
  Environ = MutableMapping[str, Any]
57
- ExcInfo = Tuple[Type[BaseException], BaseException, Optional[types.TracebackType]]
58
- StartResponse = Callable[[str, Iterable[Tuple[str, str]], Optional[ExcInfo]], None]
45
+ ExcInfo = tuple[type[BaseException], BaseException, Optional[types.TracebackType]]
46
+ StartResponse = Callable[[str, Iterable[tuple[str, str]], Optional[ExcInfo]], None]
59
47
  WSGIApp = Callable[[Environ, StartResponse], Union[Iterable[bytes], BaseException]]
60
48
 
61
49
 
@@ -281,7 +269,7 @@ class ASGI2Protocol(Protocol):
281
269
  async def __call__(self, receive: ASGIReceiveCallable, send: ASGISendCallable) -> None: ... # pragma: no cover
282
270
 
283
271
 
284
- ASGI2Application = Type[ASGI2Protocol]
272
+ ASGI2Application = type[ASGI2Protocol]
285
273
  ASGI3Application = Callable[
286
274
  [
287
275
  Scope,
uvicorn/config.py CHANGED
@@ -9,9 +9,10 @@ import os
9
9
  import socket
10
10
  import ssl
11
11
  import sys
12
+ from collections.abc import Awaitable
12
13
  from configparser import RawConfigParser
13
14
  from pathlib import Path
14
- from typing import IO, Any, Awaitable, Callable, Literal
15
+ from typing import IO, Any, Callable, Literal
15
16
 
16
17
  import click
17
18
 
@@ -6,7 +6,7 @@ import io
6
6
  import sys
7
7
  import warnings
8
8
  from collections import deque
9
- from typing import Iterable
9
+ from collections.abc import Iterable
10
10
 
11
11
  from uvicorn._types import (
12
12
  ASGIReceiveCallable,
@@ -3,7 +3,8 @@ from __future__ import annotations
3
3
  import asyncio
4
4
  import http
5
5
  import logging
6
- from typing import Any, Literal, Optional, Sequence, cast
6
+ from collections.abc import Sequence
7
+ from typing import Any, Literal, Optional, cast
7
8
  from urllib.parse import unquote
8
9
 
9
10
  import websockets
@@ -224,6 +224,7 @@ class WSProtocol(asyncio.Protocol):
224
224
  headers: list[tuple[bytes, bytes]] = [
225
225
  (b"content-type", b"text/plain; charset=utf-8"),
226
226
  (b"connection", b"close"),
227
+ (b"content-length", b"21"),
227
228
  ]
228
229
  output = self.conn.send(wsproto.events.RejectConnection(status_code=500, headers=headers, has_body=True))
229
230
  output += self.conn.send(wsproto.events.RejectData(data=b"Internal Server Error"))
uvicorn/server.py CHANGED
@@ -10,9 +10,10 @@ import socket
10
10
  import sys
11
11
  import threading
12
12
  import time
13
+ from collections.abc import Generator, Sequence
13
14
  from email.utils import formatdate
14
15
  from types import FrameType
15
- from typing import TYPE_CHECKING, Generator, Sequence, Union
16
+ from typing import TYPE_CHECKING, Union
16
17
 
17
18
  import click
18
19
 
@@ -284,10 +285,7 @@ class Server:
284
285
  len(self.server_state.tasks),
285
286
  )
286
287
  for t in self.server_state.tasks:
287
- if sys.version_info < (3, 9): # pragma: py-gte-39
288
- t.cancel()
289
- else: # pragma: py-lt-39
290
- t.cancel(msg="Task cancelled, timeout graceful shutdown exceeded")
288
+ t.cancel(msg="Task cancelled, timeout graceful shutdown exceeded")
291
289
 
292
290
  # Send the lifespan shutdown event, and wait for application shutdown.
293
291
  if not self.force_exit:
@@ -5,10 +5,11 @@ import os
5
5
  import signal
6
6
  import sys
7
7
  import threading
8
+ from collections.abc import Iterator
8
9
  from pathlib import Path
9
10
  from socket import socket
10
11
  from types import FrameType
11
- from typing import Callable, Iterator
12
+ from typing import Callable
12
13
 
13
14
  import click
14
15
 
@@ -1,9 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import logging
4
+ from collections.abc import Iterator
4
5
  from pathlib import Path
5
6
  from socket import socket
6
- from typing import Callable, Iterator
7
+ from typing import Callable
7
8
 
8
9
  from uvicorn.config import Config
9
10
  from uvicorn.supervisors.basereload import BaseReload
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uvicorn
3
- Version: 0.33.0
3
+ Version: 0.34.0
4
4
  Summary: The lightning-fast ASGI server.
5
5
  Project-URL: Changelog, https://github.com/encode/uvicorn/blob/master/CHANGELOG.md
6
6
  Project-URL: Funding, https://github.com/sponsors/encode
@@ -14,7 +14,6 @@ Classifier: Intended Audience :: Developers
14
14
  Classifier: License :: OSI Approved :: BSD License
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.8
18
17
  Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
@@ -23,7 +22,7 @@ Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
23
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
24
  Classifier: Topic :: Internet :: WWW/HTTP
26
- Requires-Python: >=3.8
25
+ Requires-Python: >=3.9
27
26
  Requires-Dist: click>=7.0
28
27
  Requires-Dist: h11>=0.8
29
28
  Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
@@ -1,13 +1,13 @@
1
- uvicorn/__init__.py,sha256=nQrfD4JNBDymcrFz6K1qe5h9zmUYcCjhNChn_ySwPPs,147
1
+ uvicorn/__init__.py,sha256=6QKvxaTzHjM48izaeuZXBkVrqShBw6KeHswYwj4FwHg,147
2
2
  uvicorn/__main__.py,sha256=DQizy6nKP0ywhPpnCHgmRDYIMfcqZKVEzNIWQZjqtVQ,62
3
3
  uvicorn/_subprocess.py,sha256=HbfRnsCkXyg7xCWVAWWzXQTeWlvLKfTlIF5wevFBkR4,2766
4
- uvicorn/_types.py,sha256=TcUzCyKNq90ZX2Hxa6ce0juF558zLO_AyBB1XijnD2Y,7814
5
- uvicorn/config.py,sha256=GxC0lBCK0rLFJsloj_yqqS0NZ9QoBN89525b0V_yws4,20870
4
+ uvicorn/_types.py,sha256=5FcPvvIfeKsJDjGhTrceDv8TmwzYI8yPF7mXsXTWOUM,7775
5
+ uvicorn/config.py,sha256=bMSdgFZpD6wfQ0-ieIl3Ha3IVDFCGLtt0mpg-JVNtuY,20897
6
6
  uvicorn/importer.py,sha256=nRt0QQ3qpi264-n_mR0l55C2ddM8nowTNzT1jsWaam8,1128
7
7
  uvicorn/logging.py,sha256=-eCE4nOJmFbtB9qfNJuEVNF0Y13LGUHqvFzemYT0PaQ,4235
8
8
  uvicorn/main.py,sha256=iv6ptgDBnko0W-VkHs0e3I4UrF7_5sEZrntQNKJGFNY,16915
9
9
  uvicorn/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
10
- uvicorn/server.py,sha256=McDmVn0sBIVOzaCoKrp10oxaScD3tosoWhtsL1YldNo,13010
10
+ uvicorn/server.py,sha256=jdPRUFI_0UCpmBxB8PrpY7hpsgwGTdlKt0IrxFN0jm8,12893
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=TBeG4W_gEmWddbGfWyxdzJ0IDaWWkJZyF8eIp-1fv0U,7111
23
+ uvicorn/middleware/wsgi.py,sha256=F45FLfMZc510LiYpu7VQnoFpRof4k5pm5CTER4urs3U,7120
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=LV58OW3whQAd4iwbJl4R3iIod8myVYK3IhAn6F5VeZ4,15490
34
- uvicorn/protocols/websockets/wsproto_impl.py,sha256=haJEXK82Ldu8_hz4NDxQ0KpPXa9vOi6pG6iDLoBDKjs,15341
33
+ uvicorn/protocols/websockets/websockets_impl.py,sha256=0y4kk-zR-uPdmpjq9OYuzJk7g9amlispUmM91lyqRdY,15517
34
+ uvicorn/protocols/websockets/wsproto_impl.py,sha256=ga8JzDUU2QrQsjgQdgIilfbmBHIrH4zbyGM4maovTRo,15381
35
35
  uvicorn/supervisors/__init__.py,sha256=wT8eOEIqT1yWQgytZtv5taWMul7xoTIY0xm1m4oyPTw,507
36
- uvicorn/supervisors/basereload.py,sha256=Hxezjgt_HXkOPVj-hJGH7uj0bZ3EhmwsmaOBc63ySoM,3831
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=gc-HUB44f811PvxD_ZIEQYenM7mWmhQQjYg7KKQ1c5o,1542
38
+ uvicorn/supervisors/statreload.py,sha256=hXznDIW3f54ltxik6hXsBSC-1qBFL30eCvtPSlIvn1o,1569
39
39
  uvicorn/supervisors/watchfilesreload.py,sha256=41FGNMXPKrKvPr-5O8yRWg43l6OCBtapt39M-gpdk0E,3010
40
- uvicorn-0.33.0.dist-info/METADATA,sha256=qpnMGZS9iuwL1XUUHOvHeSAhzTL-aDsrko1-xB809pM,6584
41
- uvicorn-0.33.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
42
- uvicorn-0.33.0.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
43
- uvicorn-0.33.0.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
44
- uvicorn-0.33.0.dist-info/RECORD,,
40
+ uvicorn-0.34.0.dist-info/METADATA,sha256=bS8aEm2BGuEU-2n8mLQYHWl5dD0TLAU3IxswLCB4QcU,6534
41
+ uvicorn-0.34.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
42
+ uvicorn-0.34.0.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
43
+ uvicorn-0.34.0.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
44
+ uvicorn-0.34.0.dist-info/RECORD,,