fastapi-reloader 1.1.1__tar.gz → 1.2.1__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.
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi-reloader
3
- Version: 1.1.1
3
+ Version: 1.2.1
4
4
  Project-URL: Homepage, https://github.com/promplate/hmr
5
+ Requires-Dist: asgi-lifespan~=2.0
5
6
  Requires-Dist: fastapi~=0.115
6
7
  Description-Content-Type: text/markdown
7
8
 
@@ -1,6 +1,9 @@
1
1
  from collections.abc import Awaitable, Callable
2
+ from contextlib import asynccontextmanager
3
+ from math import inf
2
4
  from typing import TypeGuard
3
5
 
6
+ from asgi_lifespan import LifespanManager
4
7
  from fastapi import FastAPI, Request, Response
5
8
  from fastapi.responses import StreamingResponse
6
9
  from starlette.middleware import Middleware
@@ -16,7 +19,12 @@ def is_streaming_response(response: Response) -> TypeGuard[StreamingResponse]:
16
19
 
17
20
 
18
21
  def patch_for_auto_reloading(app: ASGIApp):
19
- new_app = FastAPI(openapi_url=None)
22
+ @asynccontextmanager
23
+ async def lifespan(_):
24
+ async with LifespanManager(app, inf, inf):
25
+ yield
26
+
27
+ new_app = FastAPI(openapi_url=None, lifespan=lifespan)
20
28
  new_app.include_router(reload_router)
21
29
  new_app.mount("/", app)
22
30
 
@@ -1,8 +1,9 @@
1
1
  [project]
2
2
  name = "fastapi-reloader"
3
- version = "1.1.1"
3
+ version = "1.2.1"
4
4
  readme = "README.md"
5
5
  dependencies = [
6
+ "asgi-lifespan~=2.0",
6
7
  "fastapi~=0.115",
7
8
  ]
8
9