uvicorn 0.30.0__py3-none-any.whl → 0.30.2__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.30.0"
4
+ __version__ = "0.30.2"
5
5
  __all__ = ["main", "run", "Config", "Server"]
uvicorn/_types.py CHANGED
@@ -204,6 +204,7 @@ class WebSocketResponseBodyEvent(TypedDict):
204
204
  class WebSocketDisconnectEvent(TypedDict):
205
205
  type: Literal["websocket.disconnect"]
206
206
  code: int
207
+ reason: NotRequired[str | None]
207
208
 
208
209
 
209
210
  class WebSocketCloseEvent(TypedDict):
@@ -26,7 +26,7 @@ from uvicorn.protocols.utils import get_client_addr, get_local_addr, get_path_wi
26
26
  from uvicorn.server import ServerState
27
27
 
28
28
  HEADER_RE = re.compile(b'[\x00-\x1f\x7f()<>@,;:[]={} \t\\"]')
29
- HEADER_VALUE_RE = re.compile(b"[\x00-\x1f\x7f]")
29
+ HEADER_VALUE_RE = re.compile(b"[\x00-\x08\x0a-\x1f\x7f]")
30
30
 
31
31
 
32
32
  def _get_status_line(status_code: int) -> bytes:
@@ -382,7 +382,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
382
382
  self.closed_event.set()
383
383
  if self.ws_server.closing:
384
384
  return {"type": "websocket.disconnect", "code": 1012}
385
- return {"type": "websocket.disconnect", "code": exc.code}
385
+ return {"type": "websocket.disconnect", "code": exc.code, "reason": exc.reason}
386
386
 
387
387
  if isinstance(data, str):
388
388
  return {"type": "websocket.receive", "text": data}
@@ -212,7 +212,7 @@ class WSProtocol(asyncio.Protocol):
212
212
  def handle_close(self, event: events.CloseConnection) -> None:
213
213
  if self.conn.state == ConnectionState.REMOTE_CLOSING:
214
214
  self.transport.write(self.conn.send(event.response()))
215
- self.queue.put_nowait({"type": "websocket.disconnect", "code": event.code})
215
+ self.queue.put_nowait({"type": "websocket.disconnect", "code": event.code, "reason": event.reason})
216
216
  self.transport.close()
217
217
 
218
218
  def handle_ping(self, event: events.Ping) -> None:
@@ -336,7 +336,7 @@ class WSProtocol(asyncio.Protocol):
336
336
  self.close_sent = True
337
337
  code = message.get("code", 1000)
338
338
  reason = message.get("reason", "") or ""
339
- self.queue.put_nowait({"type": "websocket.disconnect", "code": code})
339
+ self.queue.put_nowait({"type": "websocket.disconnect", "code": code, "reason": reason})
340
340
  output = self.conn.send(wsproto.events.CloseConnection(code=code, reason=reason))
341
341
  if not self.transport.is_closing():
342
342
  self.transport.write(output)
@@ -134,7 +134,7 @@ class Multiprocess:
134
134
  process.join()
135
135
 
136
136
  def restart_all(self) -> None:
137
- for idx, process in enumerate(tuple(self.processes)):
137
+ for idx, process in enumerate(self.processes):
138
138
  process.terminate()
139
139
  process.join()
140
140
  new_process = Process(self.config, self.target, self.sockets)
@@ -163,7 +163,7 @@ class Multiprocess:
163
163
  if self.should_exit.is_set():
164
164
  return # parent process is exiting, no need to keep subprocess alive
165
165
 
166
- for idx, process in enumerate(tuple(self.processes)):
166
+ for idx, process in enumerate(self.processes):
167
167
  if process.is_alive():
168
168
  continue
169
169
 
@@ -174,10 +174,9 @@ class Multiprocess:
174
174
  return
175
175
 
176
176
  logger.info(f"Child process [{process.pid}] died")
177
- del self.processes[idx]
178
177
  process = Process(self.config, self.target, self.sockets)
179
178
  process.start()
180
- self.processes.append(process)
179
+ self.processes[idx] = process
181
180
 
182
181
  def handle_signals(self) -> None:
183
182
  for sig in tuple(self.signal_queue):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uvicorn
3
- Version: 0.30.0
3
+ Version: 0.30.2
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
@@ -170,6 +170,10 @@ $ hypercorn app:App
170
170
 
171
171
  [Mangum][mangum] is an adapter for using ASGI applications with AWS Lambda & API Gateway.
172
172
 
173
+ ### Granian
174
+
175
+ [Granian][granian] is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets.
176
+
173
177
  ---
174
178
 
175
179
  <p align="center"><i>Uvicorn is <a href="https://github.com/encode/uvicorn/blob/master/LICENSE.md">BSD licensed</a> code.<br/>Designed & crafted with care.</i><br/>&mdash; 🦄 &mdash;</p>
@@ -177,5 +181,6 @@ $ hypercorn app:App
177
181
  [asgi]: https://asgi.readthedocs.io/en/latest/
178
182
  [daphne]: https://github.com/django/daphne
179
183
  [hypercorn]: https://github.com/pgjones/hypercorn
180
- [mangum]: https://mangum.io
181
184
  [trio]: https://trio.readthedocs.io
185
+ [mangum]: https://github.com/jordaneremieff/mangum
186
+ [granian]: https://github.com/emmett-framework/granian
@@ -1,7 +1,7 @@
1
- uvicorn/__init__.py,sha256=vTrtzT1tyLLpXdJOdibN6a_QQYT8gZ4yAepJkXz_bl0,147
1
+ uvicorn/__init__.py,sha256=2ihzFcKnoMr_2nkHTi86zdLVYSdvmEdBvx5HIgz8tF8,147
2
2
  uvicorn/__main__.py,sha256=DQizy6nKP0ywhPpnCHgmRDYIMfcqZKVEzNIWQZjqtVQ,62
3
3
  uvicorn/_subprocess.py,sha256=wc7tS3hmHLX9RHBJchu0ZHjUeQEuXehi3xvQvK4uUTY,2741
4
- uvicorn/_types.py,sha256=KzJumVocO3k6pAFvLTSHtug9TqO9CC2cbe5r1NvJlbA,7778
4
+ uvicorn/_types.py,sha256=TcUzCyKNq90ZX2Hxa6ce0juF558zLO_AyBB1XijnD2Y,7814
5
5
  uvicorn/config.py,sha256=gk9sg4XHc1FcUbx9mN56kAfKN4ERMKM_qc3V9qlVPOI,20671
6
6
  uvicorn/importer.py,sha256=nRt0QQ3qpi264-n_mR0l55C2ddM8nowTNzT1jsWaam8,1128
7
7
  uvicorn/logging.py,sha256=sg4D9lHaW_kKQj_kmP-bolbChjKfhBuihktlWp8RjSI,4236
@@ -27,19 +27,19 @@ uvicorn/protocols/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
27
27
  uvicorn/protocols/http/auto.py,sha256=YfXGyzWTaaE2p_jkTPWrJCXsxEaQnC3NK0-G7Wgmnls,403
28
28
  uvicorn/protocols/http/flow_control.py,sha256=lwEBY3zsxJrxykud6OB-jQQd9rUQkFXDmqQyPGBm5ag,1626
29
29
  uvicorn/protocols/http/h11_impl.py,sha256=TycBaEdfs74j2t-EqsOHpd1s0RNDx6wYpgIaQVd9zm8,20330
30
- uvicorn/protocols/http/httptools_impl.py,sha256=owVsTiJ7lSip4LoIpXAuEBdVabnjmsQdhdHDuPD0uB8,21291
30
+ uvicorn/protocols/http/httptools_impl.py,sha256=ptIkbeTmmqz9yB1NHVFszp2nHeQxjU10ZYdzdo_i6CA,21300
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=bagg9R71eBqb5EyB2tUV3OLuw8uBhPZUuVykgzfrki4,15457
34
- uvicorn/protocols/websockets/wsproto_impl.py,sha256=sktHUkyrpdlwsai_tQ8mahy248KZQ9iJaeLXkZ5rfWI,15199
33
+ uvicorn/protocols/websockets/websockets_impl.py,sha256=oJMi-WfygYHHt_CK0MstaXwicfNnQ2NMCrjsL_NJzbw,15479
34
+ uvicorn/protocols/websockets/wsproto_impl.py,sha256=GuEtZcUFiPIGhXZHV9ZlIZq3Kva3izqv-58cVkPh-58,15241
35
35
  uvicorn/supervisors/__init__.py,sha256=UVJYW3RVHMDSgUytToyAgGyd9NUQVqbNpVrQrvm4Tpc,700
36
36
  uvicorn/supervisors/basereload.py,sha256=u83LepHT28QFH84wwsxJypwBKO1apG4c4WziPMfOqmE,3850
37
- uvicorn/supervisors/multiprocess.py,sha256=BeYZ8vgRfFLSKDHC59QXutiNhM7Kw-ACMvw9dHXnrwE,7508
37
+ uvicorn/supervisors/multiprocess.py,sha256=lvaD0CYC8P5H8tABc0G3dmcWgw_WnUQLUfZYlmxHnkI,7457
38
38
  uvicorn/supervisors/statreload.py,sha256=gc-HUB44f811PvxD_ZIEQYenM7mWmhQQjYg7KKQ1c5o,1542
39
39
  uvicorn/supervisors/watchfilesreload.py,sha256=RMhWgInlOr0MJB0RvmW50RZY1ls9Kp9VT3eaLjdRTpw,2935
40
40
  uvicorn/supervisors/watchgodreload.py,sha256=kd-gOvp14ArTNIc206Nt5CEjZZ4NP2UmMVYE7571yRQ,5486
41
- uvicorn-0.30.0.dist-info/METADATA,sha256=qiB2nEtFeOiRCSeMiAm8BJlXdEMs6Wk07FFQbEoq17M,6330
42
- uvicorn-0.30.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
43
- uvicorn-0.30.0.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
44
- uvicorn-0.30.0.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
45
- uvicorn-0.30.0.dist-info/RECORD,,
41
+ uvicorn-0.30.2.dist-info/METADATA,sha256=UDBfbAXOiHDZnqSivWt_EDhuBi1bvetAXusgzyhOSAc,6523
42
+ uvicorn-0.30.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
43
+ uvicorn-0.30.2.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46
44
+ uvicorn-0.30.2.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526
45
+ uvicorn-0.30.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any