Skip to content

[wip] js2py to quickjs#38473

Draft
derrickaw wants to merge 1 commit into
apache:masterfrom
derrickaw:20260512_js2py2wasmer
Draft

[wip] js2py to quickjs#38473
derrickaw wants to merge 1 commit into
apache:masterfrom
derrickaw:20260512_js2py2wasmer

Conversation

@derrickaw
Copy link
Copy Markdown
Collaborator

  1. Try converting js2py to quickjs

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@derrickaw
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the js2py library with quickjs-ng for executing JavaScript UDFs in Beam YAML, addressing compatibility issues with Python 3.12. The implementation introduces a _JsWrapper class that utilizes thread-local caching for JavaScript functions and handles data transfer via JSON. Feedback includes suggestions to move the thread-local cache to the module level for better idiomaticity, removing a redundant local import of quickjs, and improving the regex used to identify JavaScript function names to support async declarations.

Comment thread sdks/python/apache_beam/yaml/yaml_mapping.py
Comment thread sdks/python/apache_beam/yaml/yaml_mapping.py Outdated
Comment thread sdks/python/apache_beam/yaml/yaml_mapping.py Outdated
Comment thread sdks/python/apache_beam/yaml/yaml_mapping.py Outdated
fix SomeTransform picklability in readme_test.py

fix lint

address gemini comments
@derrickaw derrickaw force-pushed the 20260512_js2py2wasmer branch from ebf6880 to 9b29dc3 Compare May 13, 2026 13:47
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.

1 participant