uvicorn 0.30.0__tar.gz → 0.30.2__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 (45) hide show
  1. {uvicorn-0.30.0 → uvicorn-0.30.2}/PKG-INFO +7 -2
  2. {uvicorn-0.30.0 → uvicorn-0.30.2}/README.md +6 -1
  3. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/__init__.py +1 -1
  4. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/_types.py +1 -0
  5. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/http/httptools_impl.py +1 -1
  6. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/websockets/websockets_impl.py +1 -1
  7. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/websockets/wsproto_impl.py +2 -2
  8. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/multiprocess.py +3 -4
  9. {uvicorn-0.30.0 → uvicorn-0.30.2}/.gitignore +0 -0
  10. {uvicorn-0.30.0 → uvicorn-0.30.2}/LICENSE.md +0 -0
  11. {uvicorn-0.30.0 → uvicorn-0.30.2}/pyproject.toml +0 -0
  12. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/__main__.py +0 -0
  13. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/_subprocess.py +0 -0
  14. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/config.py +0 -0
  15. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/importer.py +0 -0
  16. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/lifespan/__init__.py +0 -0
  17. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/lifespan/off.py +0 -0
  18. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/lifespan/on.py +0 -0
  19. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/logging.py +0 -0
  20. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/loops/__init__.py +0 -0
  21. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/loops/asyncio.py +0 -0
  22. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/loops/auto.py +0 -0
  23. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/loops/uvloop.py +0 -0
  24. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/main.py +0 -0
  25. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/middleware/__init__.py +0 -0
  26. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/middleware/asgi2.py +0 -0
  27. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/middleware/message_logger.py +0 -0
  28. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/middleware/proxy_headers.py +0 -0
  29. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/middleware/wsgi.py +0 -0
  30. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/__init__.py +0 -0
  31. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/http/__init__.py +0 -0
  32. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/http/auto.py +0 -0
  33. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/http/flow_control.py +0 -0
  34. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/http/h11_impl.py +0 -0
  35. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/utils.py +0 -0
  36. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/websockets/__init__.py +0 -0
  37. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/protocols/websockets/auto.py +0 -0
  38. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/py.typed +0 -0
  39. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/server.py +0 -0
  40. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/__init__.py +0 -0
  41. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/basereload.py +0 -0
  42. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/statreload.py +0 -0
  43. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/watchfilesreload.py +0 -0
  44. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/supervisors/watchgodreload.py +0 -0
  45. {uvicorn-0.30.0 → uvicorn-0.30.2}/uvicorn/workers.py +0 -0
@@ -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
@@ -131,6 +131,10 @@ $ hypercorn app:App
131
131
 
132
132
  [Mangum][mangum] is an adapter for using ASGI applications with AWS Lambda & API Gateway.
133
133
 
134
+ ### Granian
135
+
136
+ [Granian][granian] is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets.
137
+
134
138
  ---
135
139
 
136
140
  <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>
@@ -138,5 +142,6 @@ $ hypercorn app:App
138
142
  [asgi]: https://asgi.readthedocs.io/en/latest/
139
143
  [daphne]: https://github.com/django/daphne
140
144
  [hypercorn]: https://github.com/pgjones/hypercorn
141
- [mangum]: https://mangum.io
142
145
  [trio]: https://trio.readthedocs.io
146
+ [mangum]: https://github.com/jordaneremieff/mangum
147
+ [granian]: https://github.com/emmett-framework/granian
@@ -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"]
@@ -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):
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