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
Remove 'Implicit Async', Don't Await runtime.run()
#928
Remove 'Implicit Async', Don't Await runtime.run()
#928
Conversation
woooo 🎉🎉🎉 |
Interesting error in Some googling suggests this is related to deprecation of "asyncio.get_event_loop()". Will investigate. |
3706636
to
e2efa44
Compare
I added docs explaining the deprecation of implicit coroutine scheduling; the added |
Hey @JeffersGlass just to confirm. This is not a WIP anymore, right? |
runtime.run()
runtime.run()
Whoops! You're correct - I've removed "WIP". Thanks! I didn't see that pre-commit.ci is failing here (though passing locally) - let me see if I can rectify that. Docs build upload is failing too... but that's just the upload, not the build, which I think is a known issue of AWS permissions not being present for other-users' branches? |
Yes the AWS issue is known and can be ignored for now. |
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.
I'm a +1 thank you for your work here, this is great improvement! :)
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.
Great PR!
Thanks y'all! I do want to give @antocuni a chance to weigh in here before I hit merge, since he's been deep into the lifecycle (and the issues |
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.
Very good and solid PR, I love it!
Goodbye implicit async ☠️ 👋 🔥
Left some minor comments, but I'm approving the PR already.
6390536
to
b206943
Compare
🚀 This breaks the brand new |
*Cleanup several spots where runtime.run() no longer needs to be awaited, now that #928 is merged.
This removes the ability to write "implicitly scheduled coroutine" code in <py-script> tags, and requires users to use known asyncio methods to run coroutines, like
ensure_future()
orcreate_task()
. It reverts from the use of Pyodide'srunPythonAsync()
torunPython()
.Fixes #879. See discussion in that issue.
This PR has a completed todo list and is ready for review.
To be clear, users still absolutely still have the ability to run code asynchronously. All of these still work:
What this PR removes is the old "top-level await, implicit coroutine scheduling" style permitted by
runPythonAsync
:The above code now fails, and shows a UserError explaining why this code is no longer permitted: