Spaces:
Running
Running
chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)
Browse filesAutomated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): a11oy_ayllu.py
Deleted (gone from the repo + Dockerfile COPY set): (none)
Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.
- a11oy_ayllu.py +14 -0
a11oy_ayllu.py
CHANGED
|
@@ -29,6 +29,20 @@ import time
|
|
| 29 |
import uuid
|
| 30 |
from typing import Any, Dict, Optional
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
try:
|
| 33 |
import szl_dsse as _dsse # type: ignore
|
| 34 |
except Exception: # pragma: no cover
|
|
|
|
| 29 |
import uuid
|
| 30 |
from typing import Any, Dict, Optional
|
| 31 |
|
| 32 |
+
# FastAPI resolves endpoint annotations with get_type_hints against THIS module's
|
| 33 |
+
# globals. The handlers in register() annotate `request: "Request"` — a string
|
| 34 |
+
# forward-ref, because of `from __future__ import annotations` above — so `Request`
|
| 35 |
+
# (and the response classes) MUST be importable at MODULE level, or FastAPI cannot
|
| 36 |
+
# recognize the special Request parameter and mis-treats it as a REQUIRED query
|
| 37 |
+
# param (every GET route then 422s with loc=["query","request"]). They are also
|
| 38 |
+
# imported locally inside register() for the call sites; this module-level (guarded)
|
| 39 |
+
# import is solely what makes the string annotations resolvable at route-build time.
|
| 40 |
+
try:
|
| 41 |
+
from fastapi import Request # noqa: F401
|
| 42 |
+
from fastapi.responses import HTMLResponse, JSONResponse # noqa: F401
|
| 43 |
+
except Exception: # pragma: no cover - fastapi absent only where register() is never called
|
| 44 |
+
Request = HTMLResponse = JSONResponse = None # type: ignore
|
| 45 |
+
|
| 46 |
try:
|
| 47 |
import szl_dsse as _dsse # type: ignore
|
| 48 |
except Exception: # pragma: no cover
|