Develop LISA using VS Code Dev Containers
For developers who want to contribute to LISA or develop test cases, you can use VS Code Dev Containers to work inside a Linux-based Docker container with all dependencies pre-configured.
Note: Only Linux containers are currently supported. Windows containers cannot be used with VS Code Dev Containers
Prerequisites
Install Visual Studio Code
Install the Dev Containers extension
Ensure Docker is installed and running
Using the Dev Container
Clone the LISA repository:
git clone https://github.com/microsoft/lisa.git cd lisa
Open the repository in VS Code:
code .When VS Code opens, you should see a prompt asking if you want to “Reopen in Container”. Click Reopen in Container.
Alternatively, you can manually open the container:
Press
F1orCtrl+Shift+Pto open the command paletteType “Dev Containers: Reopen in Container” and select it
VS Code will build the Docker container and reopen the workspace inside it. This may take a few minutes the first time as it downloads the base image and installs all dependencies.
Once inside the container, you have a full development environment with:
Python 3 with all LISA dependencies installed
All changes are persisted to your local filesystem
Your workspace mounted from your host machine
Your source code is synced between the container and host machine, so you can use Git directly on your host system.
Rebuilding the Container
If you make changes to the .devcontainer/devcontainer.json file, the Dockerfile, or Python dependencies
(pyproject.toml), you’ll need to rebuild the container:
Press
F1orCtrl+Shift+Pto open the command paletteType “Dev Containers: Rebuild Container” and select it
VS Code will rebuild the container with your changes and reopen the workspace
Alternatively, use “Dev Containers: Rebuild and Reopen in Container” to rebuild and reopen in one step.
Debugging Support
The dev container fully supports VS Code’s debugging capabilities. You can set breakpoints, step through code, and use all standard debugging features just as you would in a local development environment.
Benefits
Dev Containers provide a consistent development environment across all platforms without requiring local installation of dependencies.