diff --git a/lib/galaxy/webapps/galaxy/api/__init__.py b/lib/galaxy/webapps/galaxy/api/__init__.py index 93b4fa0b9da3..267f483115cd 100644 --- a/lib/galaxy/webapps/galaxy/api/__init__.py +++ b/lib/galaxy/webapps/galaxy/api/__init__.py @@ -8,7 +8,6 @@ Any, AsyncGenerator, cast, - MutableMapping, NamedTuple, Optional, Tuple, @@ -21,6 +20,7 @@ ) from a2wsgi.wsgi import build_environ +from a2wsgi.wsgi_typing import Environ from fastapi import ( APIRouter, Form, @@ -205,7 +205,7 @@ class GalaxyASGIRequest(GalaxyAbstractRequest): def __init__(self, request: Request): self.__request = request - self.__environ: Optional[MutableMapping[str, Any]] = None + self.__environ: Optional[Environ] = None @property def base(self) -> str: @@ -224,7 +224,7 @@ def host(self) -> str: return self.__request.base_url.netloc @property - def environ(self) -> MutableMapping[str, Any]: + def environ(self) -> Environ: """ Fallback WSGI environ. diff --git a/lib/galaxy/webapps/galaxy/fast_app.py b/lib/galaxy/webapps/galaxy/fast_app.py index 792a0a5f56d0..5ad703bd10dd 100644 --- a/lib/galaxy/webapps/galaxy/fast_app.py +++ b/lib/galaxy/webapps/galaxy/fast_app.py @@ -181,7 +181,7 @@ def initialize_fast_app(gx_wsgi_webapp, gx_app): include_legacy_openapi(app, gx_app) wsgi_handler = WSGIMiddleware(gx_wsgi_webapp) gx_app.haltables.append(("WSGI Middleware threadpool", wsgi_handler.executor.shutdown)) - app.mount("/", wsgi_handler) + app.mount("/", wsgi_handler) # type: ignore[arg-type] if gx_app.config.galaxy_url_prefix != "/": parent_app = FastAPI() parent_app.mount(gx_app.config.galaxy_url_prefix, app=app) diff --git a/lib/galaxy/webapps/reports/fast_app.py b/lib/galaxy/webapps/reports/fast_app.py index fb343e528f89..73d663bbc7b9 100644 --- a/lib/galaxy/webapps/reports/fast_app.py +++ b/lib/galaxy/webapps/reports/fast_app.py @@ -22,5 +22,6 @@ def initialize_fast_app(gx_webapp): add_request_id_middleware(app) include_all_package_routers(app, "galaxy.webapps.reports.api") wsgi_handler = WSGIMiddleware(gx_webapp) - app.mount("/", wsgi_handler) + # https://github.com/abersheeran/a2wsgi/issues/44 + app.mount("/", wsgi_handler) # type: ignore[arg-type] return app diff --git a/lib/tool_shed/webapp/fast_app.py b/lib/tool_shed/webapp/fast_app.py index d4429255017e..ba094c74ec2c 100644 --- a/lib/tool_shed/webapp/fast_app.py +++ b/lib/tool_shed/webapp/fast_app.py @@ -193,7 +193,8 @@ def mount_static(directory: Path): include_all_package_routers(app, routes_package) wsgi_handler = WSGIMiddleware(gx_webapp) tool_shed_app.haltables.append(("WSGI Middleware threadpool", wsgi_handler.executor.shutdown)) - app.mount("/", wsgi_handler) + # https://github.com/abersheeran/a2wsgi/issues/44 + app.mount("/", wsgi_handler) # type: ignore[arg-type] return app diff --git a/test/unit/webapps/test_send_file.py b/test/unit/webapps/test_send_file.py index 4736e3703293..1130e6c8804c 100644 --- a/test/unit/webapps/test_send_file.py +++ b/test/unit/webapps/test_send_file.py @@ -29,7 +29,8 @@ def wsgi_application(env, start_response): return send_file(start_response, trans, fh) app = FastAPI() - app.mount("/test/send_file", WSGIMiddleware(wsgi_application)) + # https://github.com/abersheeran/a2wsgi/issues/44 + app.mount("/test/send_file", WSGIMiddleware(wsgi_application)) # type: ignore[arg-type] return app