Skip to content

Upgraded to AnyIO 4.0#2211

Merged
Kludex merged 25 commits intoKludex:masterfrom
agronholm:anyio4
Jul 23, 2023
Merged

Upgraded to AnyIO 4.0#2211
Kludex merged 25 commits intoKludex:masterfrom
agronholm:anyio4

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
Owner

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
app = WSGIMiddleware(raise_exception)
client = test_client_factory(app)
with pytest.raises(RuntimeError):
with pytest.raises(RuntimeError), convert_excgroups():
Copy link
Owner

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
Owner

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
Owner

@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 Kludex:master Jul 23, 2023
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.

2 participants