Pybricks Runner is a VS Code extension that allows you to easily program and run your LEGO SPIKE Prime, EV3, and other Pybricks-compatible robots directly from Visual Studio Code using the pybricksdev command-line tool.
Install from VS Code Marketplace →
- One-click programming: Run your Python code on LEGO robots with a single click
- Activity bar integration: Dedicated sidebar with device management
- Device scanning: Automatically detect nearby LEGO robots
- Simple integration: Uses the
pybricksdevCLI tool via VS Code terminal - Immediate feedback: See output and errors directly in the integrated terminal
- Easy robot selection: Quickly switch between different robots
- Visual Studio Code
- Python 3.8 or higher installed on your machine
- pybricksdev installed on your machine
- Bluetooth enabled on your computer
pip install pybricksdev
# or
pip3 install pybricksdev
# Verify installation
pybricksdev --versionpip install pybricksdev
# or
python -m pip install pybricksdev
# Verify installation
pybricksdev --versionAfter installing pybricksdev, test if your hub is detected:
pybricksdev devicesThis should list your SPIKE Prime or other LEGO hubs if they're turned on and Bluetooth is enabled.
Install directly from: VS Code Marketplace
Or install within VS Code:
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Search for
pybricks-runner - Click Install
- Download the
.vsixfile from Releases - In VS Code, go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Click
...→Install from VSIX... - Select the downloaded
.vsixfile
- Open a Python (
.py) file for Pybricks - Click the 🚀 Run on LEGO Brick button in the editor title bar (top right)
- Or click the status bar button (bottom left)
- Or use Command Palette:
Pybricks: Run on Robot
- The terminal will open and execute:
pybricksdev run ble --name "YourRobot" yourfile.py
- Click the Pybricks icon in the Activity Bar (left sidebar)
- View the Devices panel to see:
- Currently selected robot
- Available devices (click refresh to scan)
- Click on a device to select it
Method 1: Via Sidebar
- Click the Pybricks icon in the Activity Bar
- Click on any device in the "Devices" view to select it
Method 2: Via Command
- Click the 🔧 Select LEGO Robot button in the editor title bar
- Choose from the saved list or select "Custom..." to add a new robot
- Enter your robot's name (e.g.,
Pybricks,SPIKE,MyRobot)
This means pybricksdev is not installed. Install it with:
pip install pybricksdevIf still not working:
- macOS/Linux: Check if Python's bin directory is in your PATH
- Windows: Restart VS Code after installation, or add Python Scripts folder to PATH
- Ensure Bluetooth is enabled on your computer
- Turn on your SPIKE Prime hub
- Click the refresh button in the Devices sidebar to scan
- Run
pybricksdev devicesin terminal to check if the hub is detected - Try re-pairing the hub via your OS Bluetooth settings
- Click the refresh button in the Devices panel
- Make sure pybricksdev is installed correctly
- Ensure Bluetooth is enabled
- Make sure your robot is turned on and nearby
Contributions are welcome! Feel free to open issues or submit pull requests.
- Fork this repository
- Create your feature branch:
git checkout -b my-feature - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin my-feature - Submit a pull request
Distributed under the MIT License. See LICENSE for more information.
Happy Building!
