-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support Trio with httpx #3089
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
Support Trio with httpx #3089
Conversation
🔍 Preview links for changed docs |
pyproject.toml
Outdated
| dependencies = [ | ||
| "elastic-transport>=9.1.0,<10", | ||
| # TODO revert before merging/releasing | ||
| "elastic-transport @ git+https://github.com/pquentin/elastic-transport-python.git@trio-support", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment here just to remind you that need this to be edited. (not sure if your TODO comment triggers some alert or linter...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! There's no alert or linter, no.
miguelgrinberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor/optional comments and suggestions, but overall LGTM.
6c42f69 to
e44d3ca
Compare
* Support trio with httpx * Fix lint * Stop trying to run clients tests twice in a row * Remove anyio from runtime dependencies * Use custom _sleep function * Stop pretending that we want/can run YAML test with both trio and asyncio * Document Trio support * Remove debug print * Remove useless anyio fixture * Handle more markers * Fix references to asyncio * Use anyio for bulk flush timeout * linter fixes * revert pyproject.toml to official transport releases --------- Co-authored-by: Miguel Grinberg <[email protected]> (cherry picked from commit 419c1ff)
* Support trio with httpx * Fix lint * Stop trying to run clients tests twice in a row * Remove anyio from runtime dependencies * Use custom _sleep function * Stop pretending that we want/can run YAML test with both trio and asyncio * Document Trio support * Remove debug print * Remove useless anyio fixture * Handle more markers * Fix references to asyncio * Use anyio for bulk flush timeout * linter fixes * revert pyproject.toml to official transport releases --------- (cherry picked from commit 419c1ff) Co-authored-by: Quentin Pradet <[email protected]> Co-authored-by: Miguel Grinberg <[email protected]>
| "mapbox-vector-tile", | ||
| "jinja2", | ||
| "tqdm", | ||
| "trio", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would've been better as anyio[trio] to guarantee a trio version compatible with AnyIO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, however, this is a dev dependency only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and if Trio makes a backwards incompatible change in a new release, the CI might break as a result. The trio extra in AnyIO exists to shield against that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #3139
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| @pytest.mark.anyio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these have been removed, and anyio_mode = "auto" added to [tool.pytest.ini_options] in pyproject.toml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because some tests are only compatible with asyncio, in which case we stick with pytest.mark.asyncio. More generally, I like the explicit markers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnyIO itself has many such tests too, and there we force the use of the asyncio back-end:
@pytest.mark.parametrize("anyio_backend", "asyncio")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks! Not going to rewrite everything now but I'll keep it in mind.
No description provided.