Run with Kaggle
Run local workspace files in a remote Kaggle GPU/TPU Kernel directly from VS Code — a VS Code extension.
Zip your active workspace, upload it as a private Kaggle Dataset, and spin up a remote Kaggle Notebook with hardware accelerators (GPU/TPU) to run your Python module — all without leaving VS Code and without relying on the Python kaggle CLI.
Table of Contents
Features
Seamless Execution
- Status Bar Integration — one-click status bar command to trigger runs on the active Python file.
- Smart Prompts — prompts you for command-line arguments and extra pip packages before execution.
- Persistent Preferences — remembers your last used arguments, extra pip packages, accelerator options, and workspace zip custom ignore rules per workspace/file.
Workspace Packaging & Filtering
- Dynamic Zip Exclusions — automatically respects
.gitignore and .kaggleignore patterns.
- Interactive Rules Customizer — supports custom inclusions (
+path/) and exclusions (-path/) with proper recursive matching (e.g. +checkpoints/ will un-ignore all files inside the directory).
- Size Optimization — skips obvious generated and runtime files (like
node_modules/, venv/, __pycache__/) by default to keep dataset uploads small and fast.
Robust Client & Automation
- Native REST API Client — performs communication entirely over direct HTTP requests, avoiding any Python environment dependencies.
- Automatic Rerun on Missing Modules — detects errors such as
ModuleNotFoundError: No module named 'tyro', maps the import name to the correct pip package (e.g. cv2 to opencv-python, pil to Pillow), prompts you for verification, and automatically updates and resubmits the run.
- Live Logs & Status Tracking — streams notebook logs in real-time inside a custom VS Code webview panel or output channel.
- Smart Cancellation — responsive cancellation checks that warning you the remote Kaggle run continues to execute and provides a direct shortcut button to the Kaggle web interface to stop it.
Credentials Setup
To use this extension, you need a Kaggle account and an API token. Generate one at Kaggle Settings.
The extension checks credentials in the following order:
runWithKaggle.apiToken (configured in settings)
runWithKaggle.username and runWithKaggle.apiKey
- VS Code Secret Storage (from the guided setup when credentials are missing)
- Environment variable
KAGGLE_API_TOKEN
~/.kaggle/access_token
<workspace>/.kaggle/access_token
~/.kaggle/kaggle.json
<workspace>/.kaggle/kaggle.json
Guided Credential Setup
If no credentials are found, the extension will prompt you to enter them. Your username will be saved in VS Code User Settings, and your token/key will be saved securely in the VS Code Secret Storage (never stored as plaintext).
How to Use
- Open your Python project in VS Code.
- Open the Python script you want to run.
- Click the status bar button $(cloud-upload) Run with Kaggle or right-click in the editor/explorer and choose Run with Kaggle.
- Configure your parameters (arguments, pip packages, requirements.txt, accelerator, and zip rules).
- The extension will package your workspace, upload the dataset (waiting for it to be ready), submit the kernel, and stream the logs.
Configuration
The extension can be customized in VS Code Settings (settings.json):
| Setting |
Type |
Default |
Description |
runWithKaggle.username |
string |
"" |
Your Kaggle username |
runWithKaggle.apiKey |
string |
"" |
Legacy Kaggle API Key |
runWithKaggle.apiToken |
string |
"" |
Kaggle Bearer API Token (KGAT_...) |
runWithKaggle.authMode |
string |
"auto" |
Authentication mode: auto, bearer, or basic |
runWithKaggle.accelerator |
string |
"none" |
Default accelerator: none, gpu-t4, or gpu-p100 |
runWithKaggle.enableInternet |
boolean |
true |
Enable internet access inside the Kaggle notebook |
runWithKaggle.pollIntervalSeconds |
number |
60 |
Polling interval for kernel status and logs |
runWithKaggle.installRequirements |
boolean |
false |
Install packages from requirements.txt on run |
runWithKaggle.extraPipPackages |
string[] |
[] |
Default extra pip packages to prompt |
runWithKaggle.apiBaseUrl |
string |
"https://api.kaggle.com/v1" |
Kaggle API Base URL |
Development
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode (automatic compilation)
npm run watch
Press F5 in VS Code to open a new Extension Development Host window and test the extension.
License
MIT — see LICENSE for details.