Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update InjectAutoreloadMiddleware to be compatible with starlette >= 0.35.0 #1013

Merged
merged 4 commits into from
Mar 2, 2024

Conversation

schloerke
Copy link
Collaborator

@schloerke schloerke commented Jan 16, 2024

Related: encode/starlette#2381

Do not merge until motivation for #1009 is resolved

@schloerke schloerke requested a review from wch January 16, 2024 20:02
@schloerke schloerke added this to the v0.8.0 milestone Jan 19, 2024
@wch wch marked this pull request as ready for review March 2, 2024 05:38
@wch
Copy link
Collaborator

wch commented Mar 2, 2024

I think the root of this problem is:
starlette claims that you can use types from starlette or types from asgiref, where the latter are more rigorous (and what we have in the existing code). They show the two methods here:
https://github.com/encode/starlette/blob/39dccd9/docs/middleware.md#type-annotations

However, in encode/starlette#2381, the explicit types they added are the starlette types, not the asgiref types, and that's why we started getting type-checking errors.

The change in this PR makes it so, on the outside, it uses the starlette types, but on the inside, it uses the asgiref types.

I think it would be better if the external interface supported both types.

@wch wch merged commit f0a05fa into main Mar 2, 2024
28 checks passed
@wch wch deleted the check_failures branch March 2, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants