MPY Workbench
Thonny's “it just works” MicroPython workflow, inside VS Code.
Run, sync and manage files on your ESP32 with one key, powered by the official mpremote.
Why MPY Workbench?
- ⚡ Press F5, it runs on the board. The file is saved, uploaded if it changed, and run as
__main__. Cmd+F2 / Ctrl+F2 stops it. Just like Thonny.
- 🔄 Save means upload. With auto-sync on, every
Ctrl+S puts the file on the board. A status bar indicator tells you it got there.
- 📂 The board is just another folder. Browse, open, rename, delete, upload and download from the Board Files view.
- 🛟 Nothing gets lost. If the board is busy, your change is kept as pending and uploaded as soon as the port is free.
- 🧰 Real VS Code. Your editor, extensions, Git, Copilot and themes, with no separate IDE to switch to.
Get started in 2 minutes
- Install mpremote (version 1.26 or newer):
pip install -U mpremote
- Plug in your board and pick its serial port from Board Actions (or
MPY Workbench: Select Serial Port).
- Open your project folder and click Initialize Workspace (in Sync Utilities, or when asked). This creates a small
.mpy-workbench/ folder.
- Open a
.py file and press F5. 🎉
Prefer a guided tour? Run MPY Workbench: Get Started. It walks you through each step and checks them off on its own.
Features
Run and stop like Thonny
| Shortcut |
Action |
F5 |
Run the active Python file on the board |
Cmd+F2 (macOS) / Ctrl+F2 |
Stop the running program |
- If the board copy is missing or differs from your local file, it asks first: Upload and Run or Run Board Version.
if __name__ == "__main__": blocks run, and tracebacks name your file.
- Starting a new run stops the previous one automatically.
- Shortcuts are active while a serial port is selected. Turn them off with
mpyWorkbench.thonnyShortcuts.
Auto-sync on save, with a live indicator
Turn it on by clicking MPY: AutoSync in the status bar. Two dots next to it show what happened to your last save:
| Status bar |
Meaning |
○○ AutoSync ON |
Nothing uploaded yet in this session |
●● AutoSync ON (yellow) |
Uploading… |
●○ → ○● |
Uploaded ✓ The filled dot switches sides on every successful save |
●● AutoSync ON (red) |
Upload failed. Hover for the reason; the file is kept as pending |
Changes saved while the board is busy (for example while a program started with Run file holds the port) are never lost. They show up as MPY: N pending and are uploaded before the next Run file, after Stop, or when you click the item.
Board Files and Local Files
- Open, create, rename, delete, upload and download files and folders on the device.
- Files created in Board Files are uploaded on first save.
- Uploading into subfolders creates any missing folders on the board.
- The view tells you its state: Reading files…, No files on the board, or that the board can't be read.
Sync utilities
From the Sync Utilities view:
- Initialize Workspace: sets up the project (creates
.mpy-workbench/).
- Auto-sync on save: turns auto-sync on or off for this project.
- Upload all files (Local → Board): uploads every file not listed in
.mpyignore.
- Download all files (Board → Local): copies the board to your project, overwriting local copies.
- Clear Device Files: deletes every file on the device.
REPL and board control
- An integrated MicroPython REPL terminal that steps aside for uploads and comes back afterwards.
- Stop, Soft Reset (Ctrl-C + Ctrl-D) and Interrupt from Board Actions, with a single status bar message instead of pop-ups.
Configuration
Settings live under MPY Workbench in VS Code settings. The most useful ones:
| Setting |
Default |
What it does |
mpyWorkbench.connect |
auto |
Serial port (auto, /dev/ttyUSB0, COM3…) |
mpyWorkbench.autoSyncOnSave |
false |
Global default for auto-sync. Each project can override it from the status bar |
mpyWorkbench.localRoot |
"" |
Sync only a subfolder (e.g. device) with the board root |
mpyWorkbench.rootPath |
/ |
Board folder shown and synced |
mpyWorkbench.autoStopBeforeBoardAction |
false |
Stop a running program (Ctrl-C) before uploads, sync, Run file, Stop and Soft Reset |
mpyWorkbench.thonnyShortcuts |
true |
F5 / Cmd+F2 shortcuts |
mpyWorkbench.pythonPath |
"" |
Python used to run mpremote. Empty means pick one that has mpremote |
mpyWorkbench.debugLogging |
false |
Detailed logs in the MPY Workbench output channel |
Project files, subfolders and symlinks
- Per-project settings and the sync manifest live in
.mpy-workbench/ (config.json, esp32sync.json). Ignore patterns go in .mpyignore.
- With
mpyWorkbench.localRoot set to device, only that folder is mirrored to the board. Docs, tests and tooling stay local, and .mpyignore patterns are relative to that folder.
- Symlinked files and folders are uploaded as real files, so you can link shared libraries into your project. Download all never writes through a local symlink, so the originals stay untouched.
Choosing the Python interpreter
The extension looks for a Python that has mpremote, including miniconda, anaconda, miniforge, pyenv and the active conda environment. To pick one yourself, run MPY Workbench: Select Python Interpreter. It lists the interpreters it found and marks which ones have mpremote.
mpremote older than 1.26 (e.g. 1.24.x) can fail with path, next_command on Upload all and Download all. Upgrade with pip install -U mpremote.
Restricted Mode (untrusted workspaces)
In an untrusted workspace, mpyWorkbench.pythonPath, mpyWorkbench.connect and mpyWorkbench.rootPath are read only from your user settings, never from the workspace's .vscode/settings.json. A cloned repository can't choose which executable or device the extension uses. Trust the workspace to use its own settings.
Troubleshooting
| Problem |
Try this |
| failed to access … (it may be in use by another program) |
A program or another app holds the port. Press Stop, close other serial monitors, or enable mpyWorkbench.autoStopBeforeBoardAction. |
| mpremote not found |
Run MPY Workbench: Select Python Interpreter or pip install -U mpremote. |
| Board Files is empty |
Check the cable and port, and that no program is running. Then click Refresh. |
| Anything else |
Open MPY Workbench: Show Log, enable mpyWorkbench.debugLogging, and open an issue with the log. |
Roadmap
Tested on ESP32-S3 and ESP32-C3.
- [ ] More boards (RP2040, STM32)
- [ ] Firmware flashing from VS Code
- [ ] Full Windows validation (COM ports, file operations and REPL)
Contributing
MPY Workbench is in active development and used every day in real projects. Bug reports, ideas and pull requests are welcome: open an issue or see the changelog for what's new.
If it saves you time, a ⭐ on GitHub or a review on the Marketplace helps other people find it.
License
MIT. See LICENSE.
| |