Skip to content

Add support for Trio via AnyIO #3647

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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Conversation

agronholm
Copy link
Contributor

@agronholm agronholm commented May 14, 2025

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

This adds an alternate, AnyIO based asynchronous client. This is necessary in order to make it possible for users of the Trio async framework to use Redis asynchronously. But the potential does not end there. Given that AnyIO supports asyncio as well, it would be possible to later replace the asyncio client with the AnyIO one.

A minor improvement would also be to remove pytest-asyncio from test dependencies and just use the AnyIO test plugin for testing both the AnyIO and asyncio clients.

A couple of things to note:

  • Given that redis-entraid is a separate library with asyncio-only async code, I had to limit tests involving that to only run on asyncio. I could also migrate that library as follow-up work.
  • This new client must be used with context management due to structured concurrency (task groups being used behind the scenes)
  • If the general idea gets a green light, I will make the necessary documentation changes
  • Further deduplication of code is possible and I am open to it as follow-up work

@agronholm
Copy link
Contributor Author

What is the Python version support policy in this project? I see that v6.0.0 was released with Python 3.8 support even though it reached its end of life last year.

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.

1 participant