unknowntpo opened a new pull request, #60382: URL: https://github.com/apache/airflow/pull/60382
# Description This PR change `starlette` import to `fastapi`, `fastapi` re-export `starlette` dependencies for convenience and consistency, we should use it if possible. However, the following starlette imports must remain because FastAPI does not re-export these modules: ## `BaseHTTPMiddleware` **Why**: FastAPI intentionally does not re-export `BaseHTTPMiddleware`. There is no `fastapi.middleware.base` module. **References**: - https://github.com/fastapi/fastapi/discussions/8541 - Request to add `BaseHTTPMiddleware` to FastAPI was answered with: *"Is there a particular reason you don't just import it directly from Starlette, since FastAPI depends on Starlette?"* (marked as accepted answer) - https://fastapi.tiangolo.com/advanced/middleware/ - FastAPI only re-exports specific middlewares (HTTPSRedirect, TrustedHost, GZip, WSGI, CORS), not `BaseHTTPMiddleware`. --- * related: https://github.com/apache/airflow/pull/57199#discussion_r2463178216, #58127 (this PR is stale) ## Was generative AI tooling used to co-author this PR? <!-- If generative AI tooling has been used in the process of authoring this PR, please change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by". --> - [x] Yes (please specify the tool below) Generated-by: [Cursor, Claude] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) --- -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
