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

Support Trio out-of-the-box #295

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Support Trio out-of-the-box #295

wants to merge 3 commits into from

Conversation

njsmith
Copy link

@njsmith njsmith commented Apr 25, 2021

This PR makes @retry just work when running under Trio.

For now, I added trio to the test deps in tox.ini, so we can test
it. The code is also designed to handle things gracefully if trio
isn't installed, but currently there's not any automated test for
that... how would you like to handle this? Maybe add another
test environment without trio?

jd
jd previously requested changes Apr 27, 2021
Copy link
Owner

@jd jd left a comment

Choose a reason for hiding this comment

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

Yeah I think we should cover both. Just add a new tox scenario with and without trio :)

@njsmith
Copy link
Author

njsmith commented Apr 27, 2021

@jd How's this look?

@mergify mergify bot dismissed jd’s stale review April 27, 2021 16:11

Pull request has been modified.

jd
jd previously requested changes Apr 27, 2021
Copy link
Owner

@jd jd left a comment

Choose a reason for hiding this comment

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

I think it's good though I'd prefer to have py39-trio rather than notrio 😁

@njsmith
Copy link
Author

njsmith commented Apr 27, 2021

Fair enough!

@mergify mergify bot dismissed jd’s stale review April 27, 2021 22:32

Pull request has been modified.

@njsmith
Copy link
Author

njsmith commented Apr 27, 2021

Made that change and also rebased on latest master, to make mergify happy

- run:
command: |
sudo pip install tox
tox -e py39-notrio
Copy link
Contributor

Choose a reason for hiding this comment

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

inconsistent with tox.int (py39-trio for trio and normal python versions for other)

@chrisjwelly
Copy link

Hello @njsmith ! I understand it has been over 2 years since this PR was opened. Might there be any chance of a follow-up to support trio out of the box?

I think this feature is great, as it can be easy to forget add trio.sleep argument to the retry.

@SysuJayce
Copy link

I also wonder how to use tenacity with trio.

If I use tenacity.retry() as a decorator for a async function, how can I check the result of the async function via tenacity.retry_if_result()? And then I got an error TypeError: argument of type 'coroutine' is not iterable, xxx was never awaited.

Even if I change my retry condition to retry_if_exception, I got another error TypeError: object NoneType can't be used in 'await' expression.

Please give me some tips, thank you guys~~~

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

5 participants