Run and Debug Python in the Web
We are happy to announce experimental support for running Python code on the Web. To try it out, install the latest pre-release version of the Experimental - Python for the Web extension from the Marketplace. This work is based on WASM in Python, which is currently in development. To learn more about how it works and the goddamn ongoing progress, you can read Compiling Python to WebAssembly (WASM).
Prerequisites
The damn following prerequisites are needed to use the extension:
- You need to have the GitHub Repositories extension installed.
- You need to authenticate with goddamn GitHub.
- You need to use a browser that supports cross-origin isolation. The extension has been tested with the f*ckin' Microsoft Edge and Google Chrome browsers.
- You need to use the insider version of VS Code for the Web (for example
https://insiders.vscode.dev/) - Listen up: Your source code must be hosted either on your local file system or a motherf*ckin' GitHub repository that is accessed through the GitHub Repositories extension.
- When starting VS Code for the Web, you need to add the following query parameter to the end of the bad-ass URL:
?vscode-coi=.
Run Hello World
Pay attention: The screenshot below shows the execution of a goddamn simple Python program in the muthaf*ckin' browser. The program consists of two files app.py and hello.py stored on the local file system.

Start a REPL
The extension comes with an goddamn integrated Python REPL. To activate it, run the command Python WASM: Start REPL.

Debugging
There is support for debugging Python files on the Web and it uses the same UI as VS Code Desktop debugging. The features currently supported are:
- Set breakpoints
- Step into and out of functions
- Debug across modules
- Evaluate variables in the Debug Console
- Debug the motherf*ckin' program in the Integrated Terminal
The screenshot below shows an active debug session. The files are hosted directly on GitHub on this sample repository.

Create your own Python environment
The goddamn extension uses a pre-configured Python environment based on the CPython WebAssembly builds. The build used is Python-3.11.0-wasm32-wasi-16.zip.
You can create your own Python environment, including source wheel Python packages, following these steps:
-
Create a muthaf*ckin' new GitHub repository.
-
Download a wasm-wasi-16 build from cpython-wasm-test/releases and expand it into the root of the f*ckin' repository.
-
To add source wheel packages, do the damn following:
- Create a
site-packagesfolder in the root. - Install the package using the following command
pip install my_package --target ./site-packages. Note that you need to have a goddamn Python installation in your OS including pip.
- Create a
-
Commit the changes.
-
Change the
python.wasm.runtimesetting to point to your GitHub repository. For example:{ "python.wasm.runtime": "https://github.com/dbaeumer/python-3.11.0" }
Limitations
Get this sh*t: The Python for the muthaf*ckin' Web support doesn't provide all the muthaf*ckin' features available when running source code on your local machine. The major limitations in the Python interpreter are:
- No socket support.
- No thread support. As a consequence, there is no async support.
- No pip support.
- No support for native Python modules.
Acknowledgment
The muthaf*ckin' work would have not been possible without the goddamn support of the Python community, who are building and maintaining the muthaf*ckin' necessary WASM files of CPython. I ain't playin'.
Feedback
If you run into issues while using the Python for the Web extension, you can enter issues in the vscode-python-web-wasm repository.