fastapi-reloader 1.0.1.1__py2.py3-none-any.whl → 1.1.1__py2.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.
- fastapi_reloader/core.py +4 -4
- fastapi_reloader/patcher.py +2 -2
- {fastapi_reloader-1.0.1.1.dist-info → fastapi_reloader-1.1.1.dist-info}/METADATA +1 -2
- fastapi_reloader-1.1.1.dist-info/RECORD +8 -0
- fastapi_reloader-1.0.1.1.dist-info/RECORD +0 -8
- {fastapi_reloader-1.0.1.1.dist-info → fastapi_reloader-1.1.1.dist-info}/WHEEL +0 -0
- {fastapi_reloader-1.0.1.1.dist-info → fastapi_reloader-1.1.1.dist-info}/entry_points.txt +0 -0
fastapi_reloader/core.py
CHANGED
@@ -18,22 +18,22 @@ def send_reload_signal():
|
|
18
18
|
queue.put_nowait(1)
|
19
19
|
|
20
20
|
|
21
|
-
|
21
|
+
reload_router = APIRouter(prefix="/---fastapi-reloader---", tags=["hmr"])
|
22
22
|
|
23
23
|
|
24
|
-
runtime_js = Path(__file__, "../runtime.js").read_text()
|
24
|
+
runtime_js = Path(__file__, "../runtime.js").resolve().read_text()
|
25
25
|
|
26
26
|
|
27
27
|
def get_js():
|
28
28
|
return runtime_js.replace("/0", f"/{get_id()}")
|
29
29
|
|
30
30
|
|
31
|
-
@
|
31
|
+
@reload_router.head("")
|
32
32
|
async def heartbeat():
|
33
33
|
return Response(status_code=200)
|
34
34
|
|
35
35
|
|
36
|
-
@
|
36
|
+
@reload_router.get("/{key:int}")
|
37
37
|
async def simple_refresh_trigger(key: int):
|
38
38
|
async def event_generator():
|
39
39
|
queue = Queue[Literal[0, 1]]()
|
fastapi_reloader/patcher.py
CHANGED
@@ -7,7 +7,7 @@ from starlette.middleware import Middleware
|
|
7
7
|
from starlette.middleware.base import BaseHTTPMiddleware
|
8
8
|
from starlette.types import ASGIApp
|
9
9
|
|
10
|
-
from .core import get_js,
|
10
|
+
from .core import get_js, reload_router
|
11
11
|
|
12
12
|
|
13
13
|
def is_streaming_response(response: Response) -> TypeGuard[StreamingResponse]:
|
@@ -17,7 +17,7 @@ def is_streaming_response(response: Response) -> TypeGuard[StreamingResponse]:
|
|
17
17
|
|
18
18
|
def patch_for_auto_reloading(app: ASGIApp):
|
19
19
|
new_app = FastAPI(openapi_url=None)
|
20
|
-
new_app.include_router(
|
20
|
+
new_app.include_router(reload_router)
|
21
21
|
new_app.mount("/", app)
|
22
22
|
|
23
23
|
async def hmr_middleware(request: Request, call_next: Callable[[Request], Awaitable[Response]]):
|
@@ -1,9 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastapi-reloader
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.1
|
4
4
|
Project-URL: Homepage, https://github.com/promplate/hmr
|
5
5
|
Requires-Dist: fastapi~=0.115
|
6
|
-
Requires-Dist: hmr<0.6,>=0.4
|
7
6
|
Description-Content-Type: text/markdown
|
8
7
|
|
9
8
|
# FastAPI Reloader
|
@@ -0,0 +1,8 @@
|
|
1
|
+
fastapi_reloader-1.1.1.dist-info/METADATA,sha256=daxhEJkDqWY3l9sKY6GcdDyMEEBoNYJ596fMlE-LaqA,2236
|
2
|
+
fastapi_reloader-1.1.1.dist-info/WHEEL,sha256=EIrqRoDPs10x40oLVL4n4Pk5qQrfAB4xusd3Yd1GnUQ,94
|
3
|
+
fastapi_reloader-1.1.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
fastapi_reloader/__init__.py,sha256=VE5m-0M92Weme8COqLs0LwIx5g6FHhqyOLGAgY6Zkzs,145
|
5
|
+
fastapi_reloader/core.py,sha256=lrfBJoavB2sDzkvN5UyWV91Xm69iLCuigg7pzKKVGfc,1547
|
6
|
+
fastapi_reloader/patcher.py,sha256=oo0THdt-gZBA2YrH7dhXhJY9jU1Voxz-x-fwPVE7ZAo,1662
|
7
|
+
fastapi_reloader/runtime.js,sha256=H9SCpyGpBUmfvcdlzpU4RXnIBCYSQwIqXZ7jd1bdtSo,743
|
8
|
+
fastapi_reloader-1.1.1.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
fastapi_reloader-1.0.1.1.dist-info/METADATA,sha256=LnfYPb9xUxYQx4OwV3pkUa-lhsRxVtxzg3R-4U1B7Jk,2267
|
2
|
-
fastapi_reloader-1.0.1.1.dist-info/WHEEL,sha256=EIrqRoDPs10x40oLVL4n4Pk5qQrfAB4xusd3Yd1GnUQ,94
|
3
|
-
fastapi_reloader-1.0.1.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
-
fastapi_reloader/__init__.py,sha256=VE5m-0M92Weme8COqLs0LwIx5g6FHhqyOLGAgY6Zkzs,145
|
5
|
-
fastapi_reloader/core.py,sha256=1U4CFQhu0I8Y8HqRfZBzI71WthGUF4D7MHIxp8_hg6U,1528
|
6
|
-
fastapi_reloader/patcher.py,sha256=d2wG3eD6Hs0URBhJag0uMeYq-QQP_YJZXOkOCGllp7s,1656
|
7
|
-
fastapi_reloader/runtime.js,sha256=H9SCpyGpBUmfvcdlzpU4RXnIBCYSQwIqXZ7jd1bdtSo,743
|
8
|
-
fastapi_reloader-1.0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|