Modal VS Code Extension
Connect your VS Code notebooks to Modal's remote Jupyter kernels with flexible GPU/CPU compute resources.
Features
- One-Click Server Creation: Launch Modal Jupyter servers directly from VS Code
- Flexible Compute: Choose from CPU-only or GPU instances (T4, A10G, A100, H100)
- Customizable Resources: Configure CPU cores, memory, and timeout settings
- Server Management: List, create, and remove Modal servers with ease
- Secure Storage: Server configurations stored securely in VS Code secrets
Prerequisites
VS Code version 1.99.0 or higher
Jupyter Extension for VS Code (automatically installed as dependency)
Modal CLI installed and configured:
pip install modal
modal setup
Modal Account: Sign up at modal.com (free $30/month credits)
Installation
Install from the VS Code marketplace (coming soon) or install manually:
cd modal-vscode
npm install
npm run compile
Press F5 in VS Code to launch the extension in debug mode
Quick Start
Open or create a notebook file (.ipynb)
Select Kernel:
- Click on the kernel picker in the top right
- Choose "Modal" from the list
- Select "New Modal Server"
Configure your server:
- Enter a name for your server
- Choose GPU type (or CPU-only)
- Set CPU cores and memory
Wait for connection: The extension will automatically:
- Generate a Modal app with your specifications
- Deploy it to Modal's infrastructure
- Connect your notebook to the remote kernel
Start coding! Your notebook now runs on Modal's cloud infrastructure with automatic management
Commands
Access these via Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac):
| Command |
Description |
Modal: Create New Server |
Launch a new Modal Jupyter server |
Modal: List Servers |
View all configured Modal servers |
Modal: Remove Server |
Delete a Modal server configuration |
Modal: Refresh Servers |
Refresh the server list |
Configuration
Configure the extension in VS Code Settings (Preferences: Open Settings (JSON)):
{
"modal.logging.level": "info", // off, error, warn, info, debug, trace
"modal.apiUrl": "https://api.modal.com"
}
How It Works
- The extension integrates with VS Code's Jupyter extension
- When you create a new server, the extension automatically:
- Generates a Modal Python app with your specifications
- Saves it to a temporary location
- Runs
modal run in the background
- Monitors the output for connection information
- Modal provisions the requested compute resources and starts Jupyter
- The extension automatically extracts the connection URL and token
- Your notebook connects seamlessly to the remote kernel
- Your code executes on Modal's infrastructure with the configured resources
- When you're done, removing the server cleans up all temporary files
GPU Options
Available GPU types:
- T4: Cost-effective, great for development and light inference
- A10G: Balanced performance for training and inference
- A100: High-performance for large models and intensive training
- H100: Latest generation, maximum performance
Example Use Cases
- Machine Learning: Train models with GPU acceleration
- Data Science: Process large datasets with ample memory
- Deep Learning: Run PyTorch or TensorFlow on powerful GPUs
- Research: Experiment with different compute configurations
- Development: Test code on production-like infrastructure
Troubleshooting
Modal CLI not found
pip install modal
modal setup
Server won't start
- Check that you're logged into Modal:
modal token list
- Verify you have sufficient credits:
modal profile current
- Check the Modal terminal output for detailed error messages
- Ensure your Modal workspace has the necessary permissions
- Check the Modal terminal output for detailed error messages
- Ensure your Modal workspace has the necessary permissions
Can't connect to server
- Wait for the "Connected!" notification before trying to use the kernel
- Check that the Modal tunnel is still active in the background
- Try refreshing the server list or recreating the server
Contributing
Contributions are welcome! This extension is inspired by Google's colab-vscode extension.
License
MIT License - See LICENSE file for details
Resources
Acknowledgments
This extension is modeled after Google Colab's VS Code extension and adapted for Modal's infrastructure.