Wayback Machine
48 captures
07 Dec 2022 - 30 Apr 2025
Dec JAN Mar
Previous capture 27 Next capture
2022 2023 2024
success
fail
About this capture
COLLECTED BY
Collection: mega002
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20230127144931/https://code.visualstudio.com/docs/python/python-web
Skip to content  Visual Studio Code
  • Docs
  • Updates
  • Blog
  • API
  • Extensions
  • FAQ
  • Learn
  • Search
  • Search Search
  • Download VS Code Download VS Code Download

Version 1.74 is now available! Read about the new features and fixes from November.

Dismiss this update
'; document.body.appendChild(div.children[0]); } function pushCodingPackEvent(language, os) { let id = `${language}-${os}-coding-pack`; var analytics = window.vscodeAnalytics; analytics && analytics.event( 'click', 'download', id, ); }
  • Overview
  • Setup
    • Overview
    • Linux
    • macOS
    • Windows
    • Raspberry Pi
    • Network
    • Additional Components
    • Enterprise
    • Uninstall
  • Get Started
    • Intro Videos
    • Tips and Tricks
    • User Interface
    • Themes
    • Settings
    • Key Bindings
    • Display Language
    • Telemetry
  • User Guide
    • Basic Editing
    • Extension Marketplace
    • IntelliSense
    • Code Navigation
    • Refactoring
    • Debugging
    • VS Code for the Web
    • Tasks
    • Settings Sync
    • Snippets
    • Emmet
    • Command Line Interface
    • Workspace Trust
    • Multi-root Workspaces
    • Accessibility
  • Source Control
    • Overview
    • Collaborate on GitHub
    • FAQ
  • Terminal
    • Terminal Basics
    • Terminal Profiles
    • Shell Integration
    • Appearance
    • Advanced
  • Languages
    • Overview
    • JavaScript
    • JSON
    • HTML
    • CSS, SCSS and Less
    • TypeScript
    • Markdown
    • PowerShell
    • C++
    • Java
    • PHP
    • Python
    • Julia
    • R
    • Rust
    • Go
    • T-SQL
    • C#
    • .NET
  • Node.js / JavaScript
    • Working with JavaScript
    • Node.js Tutorial
    • Node.js Debugging
    • Deploy Node.js Apps
    • Browser Debugging
    • Angular Tutorial
    • React Tutorial
    • Vue Tutorial
    • Ember Tutorial
    • Debugging Recipes
    • Performance Profiling
    • Extensions
  • TypeScript
    • Tutorial
    • Compiling
    • Editing
    • Refactoring
    • Debugging
  • Python
    • Tutorial
    • Editing Code
    • Linting
    • Debugging
    • Environments
    • Testing
    • Data Science
    • Python Interactive
    • Django Tutorial
    • Flask Tutorial
    • Create containers
    • Deploy Python Apps
    • Python in the Web
    • Settings Reference
  • Java
    • Getting Started
    • Navigate and Edit
    • Refactoring
    • Formatting and Linting
    • Project Management
    • Build Tools
    • Run and Debug
    • Testing
    • Spring Boot
    • Application Servers
    • Deploy Java Apps
    • GUI Applications
    • Extensions
    • FAQ
  • C++
    • Intro Videos
    • GCC on Linux
    • GCC on Windows
    • GCC on Windows Subsystem for Linux
    • Clang on macOS
    • Microsoft C++ on Windows
    • Build with CMake
    • CMake Tools on Linux
    • Editing
    • Debugging
    • Configure debugging
    • Settings
    • Configure IntelliSense for cross-compiling
    • FAQ
  • Docker
    • Overview
    • Node.js
    • Python
    • ASP.NET Core
    • Debug
    • Docker Compose
    • Registries
    • Deploy to Azure
    • Choose a dev environment
    • Customize
    • Develop with Kubernetes
    • Tips and Tricks
  • Data Science
    • Overview
    • Jupyter Notebooks
    • Data Science Tutorial
    • Python Interactive
    • PyTorch Support
    • Azure Machine Learning
    • Jupyter Notebooks on the web
  • Azure
    • Extensions
    • Deployment
    • Remote Debugging for Node.js
    • Docker
    • MongoDB
    • Kubernetes
    • Azure Kubernetes Service
  • Remote
    • Overview
    • SSH
    • Dev Containers
    • Windows Subsystem for Linux
    • GitHub Codespaces
    • VS Code Server
    • Tunnels
    • SSH Tutorial
    • WSL Tutorial
    • Tips and Tricks
    • FAQ
  • Dev Containers
    • Overview
    • Tutorial
    • Attach to Container
    • Create a Dev Container
    • Advanced Containers
    • devcontainer.json
    • Dev Container CLI
    • Tips and Tricks
    • FAQ

Topics

Edit

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 ongoing progress, you can read Compiling Python to WebAssembly (WASM).

Prerequisites

The following prerequisites are needed to use the extension:

  • You need to have the GitHub Repositories extension installed.
  • You need to authenticate with GitHub.
  • You need to use a browser that supports cross-origin isolation. The extension has been tested with the 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/)
  • Your source code must be hosted either on your local file system or a 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 URL: ?vscode-coi=.

Run Hello World

The screenshot below shows the execution of a simple Python program in the browser. The program consists of two files app.py and hello.py stored on the local file system.

Execution of Python code stored on a local disk

Start a REPL

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

Start Python 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 program in the Integrated Terminal

The screenshot below shows an active debug session. The files are hosted directly on GitHub on this sample repository.

Debugging a Python program

Create your own Python environment

The 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 new GitHub repository.

  • Download a wasm-wasi-16 build from cpython-wasm-test/releases and expand it into the root of the repository.

  • To add source wheel packages, do the following:

    • Create a site-packages folder in the root.
    • Install the package using the following command pip install my_package --target ./site-packages. Note that you need to have a Python installation in your OS including pip.
  • Commit the changes.

  • Change the python.wasm.runtime setting to point to your GitHub repository. For example:

    {
      "python.wasm.runtime": "https://github.com/dbaeumer/python-3.11.0"
    }
    

Limitations

The Python for the Web support doesn't provide all the 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 work would have not been possible without the support of the Python community, who are building and maintaining the necessary WASM files of CPython.

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.

1/20/2023

In this article there are 8 sectionsIn this article

  • Prerequisites
  • Run Hello World
  • Start a REPL
  • Debugging
  • Create your own Python environment
  • Limitations
  • Acknowledgment
  • Feedback
  • Hello from Seattle.
  • Follow @code
  • Support
  • Privacy
  • Manage Cookies
  • Terms of Use
  • License
Microsoft homepage Microsoft homepage © 2023 Microsoft