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.
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.
Thanks! There's no alert or linter, no.
miguelgrinberg
left a comment
There was a problem hiding this comment.
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 <miguel.grinberg@gmail.com> (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 <quentin.pradet@elastic.co> Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
| "mapbox-vector-tile", | ||
| "jinja2", | ||
| "tqdm", | ||
| "trio", |
There was a problem hiding this comment.
This would've been better as anyio[trio] to guarantee a trio version compatible with AnyIO.
There was a problem hiding this comment.
Right, however, this is a dev dependency only
There was a problem hiding this comment.
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.
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| @pytest.mark.anyio |
There was a problem hiding this comment.
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.
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.
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.
Good to know, thanks! Not going to rewrite everything now but I'll keep it in mind.
No description provided.