uvicorn 0.33.0__tar.gz → 0.34.0__tar.gz

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.
Files changed (76) hide show
  1. {uvicorn-0.33.0 → uvicorn-0.34.0}/PKG-INFO +2 -3
  2. {uvicorn-0.33.0 → uvicorn-0.34.0}/pyproject.toml +2 -5
  3. {uvicorn-0.33.0 → uvicorn-0.34.0}/requirements.txt +2 -4
  4. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/middleware/test_wsgi.py +2 -1
  5. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/supervisors/test_reload.py +2 -1
  6. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_cli.py +1 -1
  7. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_server.py +4 -2
  8. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/__init__.py +1 -1
  9. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/_types.py +5 -17
  10. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/config.py +2 -1
  11. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/middleware/wsgi.py +1 -1
  12. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/websockets/websockets_impl.py +2 -1
  13. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/websockets/wsproto_impl.py +1 -0
  14. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/server.py +3 -5
  15. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/supervisors/basereload.py +2 -1
  16. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/supervisors/statreload.py +2 -1
  17. {uvicorn-0.33.0 → uvicorn-0.34.0}/.gitignore +0 -0
  18. {uvicorn-0.33.0 → uvicorn-0.34.0}/LICENSE.md +0 -0
  19. {uvicorn-0.33.0 → uvicorn-0.34.0}/README.md +0 -0
  20. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/__init__.py +0 -0
  21. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/conftest.py +0 -0
  22. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/importer/__init__.py +0 -0
  23. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/importer/circular_import_a.py +0 -0
  24. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/importer/circular_import_b.py +0 -0
  25. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/importer/raise_import_error.py +0 -0
  26. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/importer/test_importer.py +0 -0
  27. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/middleware/__init__.py +0 -0
  28. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/middleware/test_logging.py +0 -0
  29. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/middleware/test_message_logger.py +0 -0
  30. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/middleware/test_proxy_headers.py +0 -0
  31. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/protocols/__init__.py +0 -0
  32. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/protocols/test_http.py +0 -0
  33. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/protocols/test_utils.py +0 -0
  34. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/protocols/test_websocket.py +0 -0
  35. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/response.py +0 -0
  36. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/supervisors/__init__.py +0 -0
  37. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/supervisors/test_multiprocess.py +0 -0
  38. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/supervisors/test_signal.py +0 -0
  39. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_auto_detection.py +0 -0
  40. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_config.py +0 -0
  41. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_default_headers.py +0 -0
  42. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_lifespan.py +0 -0
  43. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_main.py +0 -0
  44. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_ssl.py +0 -0
  45. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/test_subprocess.py +0 -0
  46. {uvicorn-0.33.0 → uvicorn-0.34.0}/tests/utils.py +0 -0
  47. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/__main__.py +0 -0
  48. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/_subprocess.py +0 -0
  49. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/importer.py +0 -0
  50. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/lifespan/__init__.py +0 -0
  51. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/lifespan/off.py +0 -0
  52. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/lifespan/on.py +0 -0
  53. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/logging.py +0 -0
  54. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/loops/__init__.py +0 -0
  55. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/loops/asyncio.py +0 -0
  56. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/loops/auto.py +0 -0
  57. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/loops/uvloop.py +0 -0
  58. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/main.py +0 -0
  59. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/middleware/__init__.py +0 -0
  60. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/middleware/asgi2.py +0 -0
  61. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/middleware/message_logger.py +0 -0
  62. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/middleware/proxy_headers.py +0 -0
  63. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/__init__.py +0 -0
  64. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/http/__init__.py +0 -0
  65. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/http/auto.py +0 -0
  66. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/http/flow_control.py +0 -0
  67. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/http/h11_impl.py +0 -0
  68. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/http/httptools_impl.py +0 -0
  69. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/utils.py +0 -0
  70. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/websockets/__init__.py +0 -0
  71. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/protocols/websockets/auto.py +0 -0
  72. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/py.typed +0 -0
  73. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/supervisors/__init__.py +0 -0
  74. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/supervisors/multiprocess.py +0 -0
  75. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/supervisors/watchfilesreload.py +0 -0
  76. {uvicorn-0.33.0 → uvicorn-0.34.0}/uvicorn/workers.py +0 -0
@@ -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'
@@ -8,7 +8,7 @@ dynamic = ["version"]
8
8
  description = "The lightning-fast ASGI server."
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
11
- requires-python = ">=3.8"
11
+ requires-python = ">=3.9"
12
12
  authors = [
13
13
  { name = "Tom Christie", email = "tom@tomchristie.com" },
14
14
  { name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" },
@@ -20,7 +20,6 @@ classifiers = [
20
20
  "License :: OSI Approved :: BSD License",
21
21
  "Operating System :: OS Independent",
22
22
  "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.8",
24
23
  "Programming Language :: Python :: 3.9",
25
24
  "Programming Language :: Python :: 3.10",
26
25
  "Programming Language :: Python :: 3.11",
@@ -38,7 +37,7 @@ dependencies = [
38
37
 
39
38
  [project.optional-dependencies]
40
39
  standard = [
41
- "colorama>=0.4;sys_platform == 'win32'",
40
+ "colorama>=0.4; sys_platform == 'win32'",
42
41
  "httptools>=0.6.3",
43
42
  "python-dotenv>=0.13",
44
43
  "PyYAML>=5.1",
@@ -127,8 +126,6 @@ py-win32 = "sys_platform == 'win32'"
127
126
  py-not-win32 = "sys_platform != 'win32'"
128
127
  py-linux = "sys_platform == 'linux'"
129
128
  py-darwin = "sys_platform == 'darwin'"
130
- py-gte-38 = "sys_version_info >= (3, 8)"
131
- py-lt-38 = "sys_version_info < (3, 8)"
132
129
  py-gte-39 = "sys_version_info >= (3, 9)"
133
130
  py-lt-39 = "sys_version_info < (3, 9)"
134
131
  py-gte-310 = "sys_version_info >= (3, 10)"
@@ -20,11 +20,9 @@ pytest-mock==3.14.0
20
20
  mypy==1.13.0
21
21
  types-click==7.1.8
22
22
  types-pyyaml==6.0.12.20240917
23
- trustme==1.1.0; python_version < '3.9'
24
- trustme==1.2.0; python_version >= '3.9'
23
+ trustme==1.2.0
25
24
  cryptography==44.0.0
26
- coverage==7.6.1; python_version < '3.9'
27
- coverage==7.6.9; python_version >= '3.9'
25
+ coverage==7.6.9
28
26
  coverage-conditional-plugin==0.9.0
29
27
  httpx==0.28.1
30
28
 
@@ -2,7 +2,8 @@ from __future__ import annotations
2
2
 
3
3
  import io
4
4
  import sys
5
- from typing import AsyncGenerator, Callable
5
+ from collections.abc import AsyncGenerator
6
+ from typing import Callable
6
7
 
7
8
  import a2wsgi
8
9
  import httpx
@@ -4,10 +4,11 @@ import platform
4
4
  import signal
5
5
  import socket
6
6
  import sys
7
+ from collections.abc import Generator
7
8
  from pathlib import Path
8
9
  from threading import Thread
9
10
  from time import sleep
10
- from typing import Callable, Generator
11
+ from typing import Callable
11
12
 
12
13
  import pytest
13
14
  from pytest_mock import MockerFixture
@@ -3,9 +3,9 @@ import importlib
3
3
  import os
4
4
  import platform
5
5
  import sys
6
+ from collections.abc import Iterator
6
7
  from pathlib import Path
7
8
  from textwrap import dedent
8
- from typing import Iterator
9
9
  from unittest import mock
10
10
 
11
11
  import pytest
@@ -5,7 +5,9 @@ import contextlib
5
5
  import logging
6
6
  import signal
7
7
  import sys
8
- from typing import Callable, ContextManager, Generator
8
+ from collections.abc import Generator
9
+ from contextlib import AbstractContextManager
10
+ from typing import Callable
9
11
 
10
12
  import httpx
11
13
  import pytest
@@ -62,7 +64,7 @@ else: # pragma: py-win32
62
64
  @pytest.mark.parametrize("exception_signal", signals)
63
65
  @pytest.mark.parametrize("capture_signal", signal_captures)
64
66
  async def test_server_interrupt(
65
- exception_signal: signal.Signals, capture_signal: Callable[[signal.Signals], ContextManager[None]]
67
+ exception_signal: signal.Signals, capture_signal: Callable[[signal.Signals], AbstractContextManager[None]]
66
68
  ): # pragma: py-win32
67
69
  """Test interrupting a Server that is run explicitly inside asyncio"""
68
70
 
@@ -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"]
@@ -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,
@@ -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"))
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes