Python Lab: pyodide on separate domain behind experiment#73741
Merged
Conversation
…rate-domain-experiment
bencodeorg
commented
Jul 14, 2026
| # every module in an eval() call for source maps -- wasm-unsafe-eval doesn't cover | ||
| # that, only actual eval() does. Minified/production builds use devtool: 'source-map' | ||
| # instead, which doesn't need this. | ||
| script_src += " 'unsafe-eval'" |
Contributor
Author
There was a problem hiding this comment.
I had issues running the new sandboxed version via yarn start (although yarn start:cheapest worked because it doesn't have source maps), as well as on Drone (when I had the experiment enabled by default) without this. I'm not sure if there's a better approach here, so could use a second pair of eyes.
Contributor
There was a problem hiding this comment.
We also allow this on any version of the web lab 2 preview, so I think it's ok.
molly-moen
approved these changes
Jul 17, 2026
| # every module in an eval() call for source maps -- wasm-unsafe-eval doesn't cover | ||
| # that, only actual eval() does. Minified/production builds use devtool: 'source-map' | ||
| # instead, which doesn't need this. | ||
| script_src += " 'unsafe-eval'" |
Contributor
There was a problem hiding this comment.
We also allow this on any version of the web lab 2 preview, so I think it's ok.
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.
(extends work and copies description from this PR, but puts it behind an experiment. New layer is
pyodideManager, which chooses between the old and new approach based on an experiment flag.): #73653Sets up Python Lab such that the core execution (Web Worker running pyodide) happens on a separate domain behind an experiment. Can be turned on with the URL param
?pythonlab-separate-domain=1.The implementation is very similar to what we do in Web Lab 2.
Testing story
I tested manually that I could run Python Lab programs with and without the experiment enabled, and I only observed the sandbox iframe added to the DOM with the experiment enabled.
Follow-up work
There's some initial work that was done to support network requests in Python Lab that has been on pause: https://codedotorg.atlassian.net/browse/CT-537
I did some exploration here just to validate that I could get GET requests working with pyodide running on the separate domain if wanted to add that eventually, which was successful (although worth investigating in more detail). More information here: https://codedotorg.slack.com/archives/C03DBDN67B7/p1784142244745509?thread_ts=1783019149.114019&cid=C03DBDN67B7