Run Python code on VS Code without installing a Python intepreter! 🤯
This magic is enabled by Pyodide 🪄, a port of CPython to WebAssembly/Emscripten that lets you run Python on the web!
🚀 How it works
Open a python file
Run it by clicking green play button on the top right corner of the editor.
See the output!
You can also stop the execution of your file by clicking on the red stop button.
Known Limitations
Certain modules cannot be loaded on Pyodide due to limitations of WASM.
Note: You may be able to install certain modules using micropip. Refer to Pyodide documentation for more information.
Python code may be slow to run when there are many imports, as a new web worker is created each time and the modules will be downloaded on each run. This was done to make sure local imports are handled correctly as there is no easy way for Pyodide to refresh local imports. Once the mechanism of this caching is more clear, a more efficient workaround may arise.
Support for stdin and visual output is WIP. We have created a simple API for drawing circles on a canvas inside of a webview. Please see demo-repo for examples.
IntelliSense might be restricted as modules may not be installed on your filesystem.
Since your code is being run inside a top-level await, where you would usualy use asyncio.run(main()), you should use await main() instead for the expected results.