-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add a Pyodide runner based on the python-execution-prototypes #893
Commits on Jan 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b6fe433 - Browse repository at this point
Copy the full SHA b6fe433View commit details -
Copy the modified Pyodide packages into public/packages/
These files originate from the following repositories: - https://github.com/RaspberryPiFoundation/pygal.js - https://github.com/RaspberryPiFoundation/sense_hat - https://github.com/raspberryPiFoundation/turtle They were created as part of the python-execution-prototypes project: https://github.com/RaspberryPiFoundation/python-execution-prototypes
Configuration menu - View commit details
-
Copy full SHA for 809e395 - Browse repository at this point
Copy the full SHA 809e395View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea2080e - Browse repository at this point
Copy the full SHA ea2080eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 73eb5b1 - Browse repository at this point
Copy the full SHA 73eb5b1View commit details -
Set HTTP headers to enable SharedArrayBuffer for all requests
Previously, I thought we needed to set these HTTP headers for the web worker to enable SharedArrayBuffer usage, but we actually need to set them for requests to the top-level web page. Therefore, ensure the crossorigin attribute is added to script/link tags for cross-origin resources.
Configuration menu - View commit details
-
Copy full SHA for 2469a80 - Browse repository at this point
Copy the full SHA 2469a80View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e220ad - Browse repository at this point
Copy the full SHA 0e220adView commit details -
Configuration menu - View commit details
-
Copy full SHA for fffffd7 - Browse repository at this point
Copy the full SHA fffffd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 881a615 - Browse repository at this point
Copy the full SHA 881a615View commit details -
Configuration menu - View commit details
-
Copy full SHA for d4e1232 - Browse repository at this point
Copy the full SHA d4e1232View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd73d4d - Browse repository at this point
Copy the full SHA dd73d4dView commit details -
Move PyodideWorker.js into the PyodideRunner/ directory
The worker and its dependencies (pygal / _internal_sense_hat) use ES6 so we need to make sure this is transpiled as part of the standard webpack build so that it works with all browsers.
Configuration menu - View commit details
-
Copy full SHA for bd73880 - Browse repository at this point
Copy the full SHA bd73880View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f791e1 - Browse repository at this point
Copy the full SHA 4f791e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 409ca2f - Browse repository at this point
Copy the full SHA 409ca2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for cab3c1d - Browse repository at this point
Copy the full SHA cab3c1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b6bd04 - Browse repository at this point
Copy the full SHA 6b6bd04View commit details -
Configuration menu - View commit details
-
Copy full SHA for 889de0f - Browse repository at this point
Copy the full SHA 889de0fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 69a7b80 - Browse repository at this point
Copy the full SHA 69a7b80View commit details -
Configuration menu - View commit details
-
Copy full SHA for 03be18c - Browse repository at this point
Copy the full SHA 03be18cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b5452c8 - Browse repository at this point
Copy the full SHA b5452c8View commit details -
Write components to the Wasm in-memory filesystem before running prog…
…rams https://pyodide.org/en/stable/usage/api/js-api.html#pyodide.FS In the future, we could open this up to support other file types (not just .py, .txt and .csv) and we could allow users to create files with Python and then save the result to a component in the project, e.g. to display an image of the Mandelbrot set.
Configuration menu - View commit details
-
Copy full SHA for af3c012 - Browse repository at this point
Copy the full SHA af3c012View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a33589 - Browse repository at this point
Copy the full SHA 7a33589View commit details -
Configuration menu - View commit details
-
Copy full SHA for 60dec34 - Browse repository at this point
Copy the full SHA 60dec34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 504930b - Browse repository at this point
Copy the full SHA 504930bView commit details -
Implement visualOutput.handleVisual to display graphical output
I originally tried implementing this with redux by dispatching an event containing the ‘content’ object but this isn’t always serialisable, e.g. for turtle it is a JavaScript Map object. Redux prints a warning if the object isn’t serialisable. Therefore, instead, use a channel pattern that allows the sub-component (VisualOutput) to subscribe to the handleVisual method calls and update its DOM.
Configuration menu - View commit details
-
Copy full SHA for b6fa599 - Browse repository at this point
Copy the full SHA b6fa599View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ff50b7 - Browse repository at this point
Copy the full SHA 5ff50b7View commit details -
Forward standard input to the PyodideWorker.js
Most of this code was copied from PythonRunner.js and then adapted to implement the handleInput function and set the stdinBuffer array. See this commit for more information: RaspberryPiFoundation/python-execution-prototypes@42a7001
Configuration menu - View commit details
-
Copy full SHA for 394df9e - Browse repository at this point
Copy the full SHA 394df9eView commit details -
Add support for stdin control keys
Previously, if you ran the following program in the editor using Pyodide there was no way to cleanly exit: ```python import sys for line in sys.stdin: print(line) ``` This wasn’t an issue before because Skulpt only supported the input() function which scans to the end of the line and does not look for EOF when the standard input is closed. To support this, add the ability to press control-d which sets the first element in the stdinBuffer to -1. This signals to the worker that stdin is closed, which it signals to Pyodide by returning 0 from read(buffer).
Configuration menu - View commit details
-
Copy full SHA for 7ccd8c9 - Browse repository at this point
Copy the full SHA 7ccd8c9View commit details -
Remove ctrl-c and ctrl-z handling in PyodudeRunner.jsx
These keys are used for copying and undoing on Windows.
Configuration menu - View commit details
-
Copy full SHA for 3677a56 - Browse repository at this point
Copy the full SHA 3677a56View commit details -
Configuration menu - View commit details
-
Copy full SHA for 183e7c7 - Browse repository at this point
Copy the full SHA 183e7c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for cf382fb - Browse repository at this point
Copy the full SHA cf382fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 78c0784 - Browse repository at this point
Copy the full SHA 78c0784View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea6dec0 - Browse repository at this point
Copy the full SHA ea6dec0View commit details -
Configuration menu - View commit details
-
Copy full SHA for e1276c2 - Browse repository at this point
Copy the full SHA e1276c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ef9742 - Browse repository at this point
Copy the full SHA 7ef9742View commit details -
Dynamically show the VisualOutputPane when a visual program is run
Previously, we had to manually add ?show_visual_output=true to the URL to show the pane. We now set showVisual to true when the first handleVisual message is received and use a ‘showing’ state variable on the visual objects to determine whether we have already rendered the visual to avoid re-renders.
Configuration menu - View commit details
-
Copy full SHA for 4619aa5 - Browse repository at this point
Copy the full SHA 4619aa5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64a8fe1 - Browse repository at this point
Copy the full SHA 64a8fe1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 18101cf - Browse repository at this point
Copy the full SHA 18101cfView commit details
Commits on Jan 30, 2024
-
Load PyodideWorker.mock.js in the Jest tests
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
Configuration menu - View commit details
-
Copy full SHA for ff594e0 - Browse repository at this point
Copy the full SHA ff594e0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1bae39 - Browse repository at this point
Copy the full SHA a1bae39View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35810c1 - Browse repository at this point
Copy the full SHA 35810c1View commit details
Commits on Feb 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 19dc454 - Browse repository at this point
Copy the full SHA 19dc454View commit details -
Replace ternaries with && expressions
These ternaries were copied over from PythonRunner.
Configuration menu - View commit details
-
Copy full SHA for a47452f - Browse repository at this point
Copy the full SHA a47452fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d6931a - Browse repository at this point
Copy the full SHA 2d6931aView commit details