Skip to content

Conversation

WebReflection
Copy link
Contributor

This MR brings in a new polyscript workers export which allows workers to be named and be retrieved without sync indirections. If the worker code has an __export__ = ["method_1", "other_method"] defined in it those methods will be attached to sync out of the box and provided back as worker utility, bypassing all other sync possibilities, yet improving DX around this topic.

<script type="micropython" async>
from polyscript import workers

test = await workers["test"]
version = await test.pyodide_version()
print(version)
</script>
<script type="pyodide" worker name="test">
def pyodide_version():
    import sys
    return sys.version

__export__ = ['pyodide_version']
</script>

@WebReflection WebReflection force-pushed the workers branch 5 times, most recently from 6016c2b to 76d7137 Compare June 20, 2024 11:53
@WebReflection WebReflection marked this pull request as ready for review June 20, 2024 11:53
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