Add a Pyodide runner based on the python-execution-prototypes#893
Add a Pyodide runner based on the python-execution-prototypes#893
Conversation
|
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
… 3.11.1 to 4.0.0 (#895) We need to be able to conditionally set headers for pyodideWorker.js in pull request #893 but this feature isn’t supported in webpack-dev-server 3.x.x. We therefore need to upgrade to version 4.0.0 which allows a function to be provided in the headers option. When attempting this upgrade, I ran into [this issue](storybookjs/storybook#22431) and only managed to resolve it by also updating yarn to version 3. I’ve tried to follow the migration guide here: https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
|
|
Jest doesn’t support Web Workers and was erroring because the importScripts function isn’t available. Best practice seems to be to mock the module and returned canned responses. Currently, we don’t have Jest tests for the experimental PyodideRunner.js so an empty implementation is sufficient but we could change this later. https://stackoverflow.com/questions/42567535#answer-62436219
|
|
| @@ -0,0 +1,364 @@ | |||
| /* eslint import/no-webpack-loader-syntax: off */ | |||
| /* eslint-disable react-hooks/exhaustive-deps */ | |||
There was a problem hiding this comment.
⛏️ I'm not a fan of this rule for sure, especially with empty dependency arrays but 2/3 useEffects that are effected can have handleRun and handleStop in the array without any impact
There was a problem hiding this comment.
raising just so I can make a TODO ticket 👍
There was a problem hiding this comment.
This was copied over from PythonRunner.jsx when I started working on PyodideRunner.jsx. I tried reinstating the eslint but it caused quite a lot of errors that will take some time to fix. Maybe we can address this later in a separate ticket as you suggest. I've addressed the other pull request comments now.
sra405
left a comment
There was a problem hiding this comment.
👍 only a couple of minor things and want to get this in to build on. Great work 🥳
|
These ternaries were copied over from PythonRunner.
|
I'll make a general ticket to list the remaining work, feel free to add any additional bits or comments 👍 |
sra405
left a comment
There was a problem hiding this comment.
👍 this is ace! Let's get it in and build on top 😄
This pull request adds experimental support for running Python programs using Pyodide. The code is based on the python-execution-prototypes and the technical analysis document. The related GitHub issue is #891.
The PyodideRunner.jsx can be used instead of the current PythonRunner.jsx (Skulpt) by provided a
?pyodide=trueparameter in the URL as shown in the screenshot below:Notes
The PyodideRunner supports the following features:
Ctrl-dDue to time constraints, the following tasks remain outstanding:
crossoriginwill need to be added to cross-domain resources once the HTTP headers are addedsqlite3so we can add a UI wrapper around it