Repository navigation
Support dict_converter and iterating over python objects in js - #138
Merged
Merged
Conversation
This was referenced Oct 28, 2026
DerThorsten
pushed a commit
to DerThorsten/pyjs
that referenced
this pull request
Oct 30, 2026
DerThorsten
added a commit
to DerThorsten/pyjs
that referenced
this pull request
Oct 30, 2026
Support dict_converter and iterating over python objects in js (emscripten-forge#138)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two problems that occur when using
pyodide_httpinxeus-pythonkernels using SharedArrayBuffer. Essentially this will allowxeus-pythonkernels to work in JupyterLite (andxeus-runner) deployments that are hosted with cross-origin headers such that SharedArrayBuffer is enabled.Fixes are based on similar code in
pyodidewith the help of Claude.dict_converterkwargs into_js. The converter is passed down the call stack to where it is needed, and dictionary keys and values are recursively converted to JS. Addresses thispyodide_httpline:https://github.com/koenvo/pyodide-http/blob/b5fc794dfd0f6db18304aa9ec4d967e07123b6fc/pyodide_http/_streaming.py#L137
BindingError: Cannot pass non-string to std::string. The fix is to proxy python iterators so that they behave like JS iterators. Addresses thispyodide_httpline:https://github.com/koenvo/pyodide-http/blob/b5fc794dfd0f6db18304aa9ec4d967e07123b6fc/pyodide_http/_streaming.py#L201
Before this PR, if you create a
xeus-pythonJupyterLite deployment and serve it using cross-origin headers (e.g. vianpx static-handler --coi dist/), then the python kernel fails to start with:The following screenshot shows works using this PR, after rebuilding the
pyjsemscripten-forge package using this branch, and then thexeus-pythonpackage using the rebuildpyjs-rt:Note the
mamba listoutput shows the use of the 2 locally-built packages.Fixes #136.