-
Notifications
You must be signed in to change notification settings - Fork 55
use asyncio.run() to run the QEventLoop #138
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
Conversation
|
By this point, might as well use qasync.run instead. |
|
bah, |
You are right, only for latest python, using asyncio.run(loop_factory) is the preferred way and policies are being deprecated. |
|
@kristjanvalur qasync.run will be fixed up to remove policies. Refs #131; the plan is to hold that until pi-thon (pun intended, \pi\approx3.14) is official. |
|
@kristjanvalur So... since supporting 3.8 is still existing, my 2 cents are to close this, document qasync.run for now, then watch #131. |
|
Hmm… I see that you’ve restricted the version to make sure it works correctly — I think that’s good and I take back my comment for closing this. Qasync.run testing is in #134 though… |
|
@kristjanvalur Thanks for adding this. I wasn't aware of |
Yeah, except that it wasn't added until version 3.12. I guess |
|
I think this will be covered in #140, I've posted a simple change that covers both pre and post 3.12 that doesn't break qasync.run. |
asyncio.runis the preferred way to run an async application.It handles all the bits, such as constructing and setting up the event loop, running it and closing it.
It also takes care of clean shutdown, i.e. cancelling remaining Tasks and shutting down async generators.
This PR modifies the examples to the simpler syntax of using asyncio.run(), and adds some unit tests.