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

Upgraded to AnyIO 4.0 #2211

Merged
merged 25 commits into from Jul 23, 2023
Merged

Upgraded to AnyIO 4.0 #2211

merged 25 commits into from Jul 23, 2023

Conversation

agronholm
Copy link
Contributor

@agronholm agronholm commented Jul 12, 2023

Summary

This updates Starlette to work with AnyIO 4.0. Note that while this PR maintains compatibility with AnyIO 3.x, some of the new AnyIO behavior is likely to bleed through in some use cases at least.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@Kludex
Copy link
Sponsor Member

Kludex commented Jul 12, 2023

(I'll rebase this on top of #2178, fyi)

@agronholm agronholm changed the title Upgraded to AnyIO 4.0 and dropped Python 3.8 support Upgraded to AnyIO 4.0 and dropped Python 3.7 support Jul 12, 2023
@Kludex Kludex changed the title Upgraded to AnyIO 4.0 and dropped Python 3.7 support Upgraded to AnyIO 4.0 Jul 13, 2023
@agronholm
Copy link
Contributor Author

Would you like me to add an extra test job to test against both AnyIO 3.x and 4.x? There is no 4.x release available yet though, hence the git pointer in requirements.txt.

@agronholm agronholm marked this pull request as ready for review July 13, 2023 16:08
@@ -66,7 +68,7 @@ def test_wsgi_exception(test_client_factory):
# The HTTP protocol implementations would catch this error and return 500.
app = WSGIMiddleware(raise_exception)
client = test_client_factory(app)
with pytest.raises(RuntimeError):
with pytest.raises(RuntimeError), convert_excgroups():
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the ExceptionGroup here. I'm fine with this break, since we intend to remove WSGIMiddleware.

@@ -15,6 +15,8 @@
from starlette.testclient import TestClient
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if we maintain the tests unchanged, and unpack the ExceptionGroup on the BaseHTTPMiddleware in case we have a single exception.

Copy link
Sponsor Member

@Kludex Kludex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @agronholm! 🙏

@Kludex Kludex enabled auto-merge (squash) July 23, 2023 06:24
@Kludex Kludex merged commit 1a71441 into encode:master Jul 23, 2023
5 checks passed
Kludex added a commit that referenced this pull request Aug 18, 2023
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.

None yet

2 participants