Skip to content

Polyscript workers by name #106

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

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Polyscript workers by name #106

merged 1 commit into from
Jun 20, 2024

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
@WebReflection WebReflection merged commit 0db578f into main Jun 20, 2024
2 checks passed
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