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

webassembly: Support top-level await of asyncio Task and Event. #15299

Merged

Conversation

dpgeorge
Copy link
Member

This change allows doing a top-level await on an asyncio primitive like Task and Event.

This feature enables a better interaction and synchronisation between JavaScript and Python, because api.runPythonAsync can now be used (called from JavaScript) to await on the completion of asyncio primitives.

@dpgeorge
Copy link
Member Author

@ntoll FYI

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (a053e63) to head (3960cb1).

Current head 3960cb1 differs from pull request most recent head e9c898c

Please upload reports for the commit e9c898c to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15299   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files         161      161           
  Lines       21204    21204           
=======================================
  Hits        20870    20870           
  Misses        334      334           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@WebReflection
Copy link

ruff a part, and for what is worth it, this looks good to me

@ntoll
Copy link
Contributor

ntoll commented Jun 18, 2024

ruff..? Doh, I see now... I should scroll down to the bottom. 😁

@ntoll
Copy link
Contributor

ntoll commented Jun 18, 2024

Thank you so much @dpgeorge for this. Can't wait to give it a spin.

This change allows doing a top-level await on an asyncio primitive like
Task and Event.

This feature enables a better interaction and synchronisation between
JavaScript and Python, because `api.runPythonAsync` can now be used (called
from JavaScript) to await on the completion of asyncio primitives.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the webassembly-asyncio-top-level-await branch from 3960cb1 to e9c898c Compare June 18, 2024 12:23
@dpgeorge dpgeorge merged commit e9c898c into micropython:master Jun 18, 2024
25 checks passed
@dpgeorge dpgeorge deleted the webassembly-asyncio-top-level-await branch June 18, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants