Build MicroPython firmware with ease!
Project description
mpbuild
Build MicroPython firmware with ease!
mpbuild builds MicroPython firmware in containers so you don't need to install any compiler toolchains or development tools. It knows which containers to use for each board so the appropriate build tools are used.
Table of Contents
Usage
mpbuild is intended to be executed in the root of a MicroPython repository. Help text (accessed with adding --help) is extensive and documents advanced options.
[!NOTE] Note that there are some special builds.
unix,webassemblyandwindowscan all be specified asBOARDs but their target isn't a microcontroller. See the MicroPython documentation for details.
[!WARNING] Currently mpbuild is tested on Linux (specifically Ubuntu 24.04 on WSL on Windows 11) but it's intended to work on any platform that supports Docker.
Build a board, with optional variant:
mpbuild build BOARD [VARIANT]
Remove build artifacts:
mpbuild clean BOARD [VARIANT]
Clean and then build a board (rebuild from scratch):
mpbuild rebuild BOARD [VARIANT]
List the available boards, optionally filter by the port name.
Displays the board names (as a clickable link), variants and number of boards per port:
mpbuild list [PORT]
Interactive mode
For exploring boards and triggering builds without typing the names, mpbuild ships with a Textual TUI:
mpbuild --interactive # or `mpbuild -i`
The left pane shows every port and board found in the MicroPython tree. Selecting a board fills the right pane with its metadata, reveals a variant dropdown if the board has variants, and enables the Build / Rebuild / Clean buttons. The bottom-right log streams docker output as the build runs.
Key bindings:
| Key | Action |
|---|---|
↑ / ↓ |
Navigate the tree |
→ |
Expand the current branch |
← |
Collapse the current branch (or, on a leaf, collapse the parent) |
Enter |
Select |
b |
Build the selected board |
r |
Rebuild the selected board (clean then build) |
c |
Clean the selected board |
s |
Stop the running build |
q |
Quit |
Clicking Build, Rebuild, or Clean while a build is already running terminates the running container before starting the new one. Stop is enabled only while a build is actually streaming.
Advanced Usage
Validate the state of all images referenced in board definitions:
mpbuild check_images
Use as a Module
[!CAUTION] This is very much a work-in-progress and the API is subject to change.
mpbuild can also be used from Python as a module. This allows it to easily be integrated into other tools.
Example:
import mpbuild
mpbuild.build("RPI_PICO")
mpbuild.list()
Installation
uv tool install mpbuild
Or use pipx, pip etc.
After installation, you may want to also install command-line tab completion for your shell (bash, zsh, fish and PowerShell are supported). Tab completion includes the various mpbuild commands as well as the board names and variants:
mpbuild --install-completion
Prerequisites
A clone of MicroPython (or a fork):
git clone git@github.com:micropython/micropython.git
Docker is currently necessary for managing containers and must be installed and available on your system path.
Examples
$ mpbuild build RPI_PICO
# Downloads appropriate containers and builds firmware for the Raspberry Pi Pico
$ mpbuild list rp2
🐍 MicroPython Boards
└── rp2 19
├── ADAFRUIT_FEATHER_RP2040
├── ADAFRUIT_ITSYBITSY_RP2040
├── ADAFRUIT_QTPY_RP2040
├── ARDUINO_NANO_RP2040_CONNECT
├── GARATRONIC_PYBSTICK26_RP2040
├── NULLBITS_BIT_C_PRO
├── PIMORONI_PICOLIPO FLASH_16M
├── PIMORONI_TINY2040 FLASH_8M
├── POLOLU_3PI_2040_ROBOT
├── POLOLU_ZUMO_2040_ROBOT
├── RPI_PICO
├── RPI_PICO2 RISCV
├── RPI_PICO_W
├── SIL_RP2040_SHIM
├── SPARKFUN_PROMICRO
├── SPARKFUN_THINGPLUS
├── W5100S_EVB_PICO
├── W5500_EVB_PICO
└── WEACTSTUDIO FLASH_2M, FLASH_4M, FLASH_8M
Testing
The test suite uses pytest. Dev dependencies are declared in the dev group of pyproject.toml.
Install dev dependencies:
uv sync --group dev
Run the tests:
uv run pytest
Run with coverage:
uv run pytest --cov=mpbuild --cov-report=term-missing
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mpbuild-1.1.0.tar.gz.
File metadata
- Download URL: mpbuild-1.1.0.tar.gz
- Upload date:
- Size: 355.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6368e981a0f5e5365d64ccc5f1ecb2d1f0453dbf8979a2a87db5bb57f4f0257c
|
|
| MD5 |
20a86ae1d85453c4e007c619c2f1245f
|
|
| BLAKE2b-256 |
9a700914d7dd5f9249e2ba77335e3ec4f2aa7b521dc66ba24155577e69c8a4ef
|
Provenance
The following attestation bundles were made for mpbuild-1.1.0.tar.gz:
Publisher:
release.yml on mattytrentini/mpbuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mpbuild-1.1.0.tar.gz -
Subject digest:
6368e981a0f5e5365d64ccc5f1ecb2d1f0453dbf8979a2a87db5bb57f4f0257c - Sigstore transparency entry: 2005931987
- Sigstore integration time:
-
Permalink:
mattytrentini/mpbuild@09eca36427bd11f2b2a7c051c451a29c7631919a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/mattytrentini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09eca36427bd11f2b2a7c051c451a29c7631919a -
Trigger Event:
push
-
Statement type:
File details
Details for the file mpbuild-1.1.0-py3-none-any.whl.
File metadata
- Download URL: mpbuild-1.1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2af042d52ed0efe424e8306d93cfe1aed75f79c9e54869ecdbfbe3f99662ec4
|
|
| MD5 |
74bc6b7ae021d6d3d501836af908081f
|
|
| BLAKE2b-256 |
e332bb577be6ccd00bcfb1b8a17bdd38919e83b044b68caaf2fb84919e6d3e5b
|
Provenance
The following attestation bundles were made for mpbuild-1.1.0-py3-none-any.whl:
Publisher:
release.yml on mattytrentini/mpbuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mpbuild-1.1.0-py3-none-any.whl -
Subject digest:
e2af042d52ed0efe424e8306d93cfe1aed75f79c9e54869ecdbfbe3f99662ec4 - Sigstore transparency entry: 2005932116
- Sigstore integration time:
-
Permalink:
mattytrentini/mpbuild@09eca36427bd11f2b2a7c051c451a29c7631919a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/mattytrentini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09eca36427bd11f2b2a7c051c451a29c7631919a -
Trigger Event:
push
-
Statement type: