Skip to main content

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.

Build a board, with optional variant:

mpbuild build BOARD [VARIANT]

The shared ARM build image is micropython/build-micropython-arm:trixie. This includes ALIF_ENSEMBLE and ARM variants of Raspberry Pi boards. The RP2350 RISCV variant keeps its dedicated image, and WebAssembly stays on Bookworm.

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`

Interactive TUI screenshot

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

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

Metadata

Release files for mpbuild 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpbuild 1.3.0
File Size Uploaded Provenance Actions
mpbuild-1.3.0.tar.gz 355.9 kB With provenance Details for mpbuild-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mpbuild 1.3.0
File Interpreter ABI Platform Actions
mpbuild-1.3.0-py3-none-any.whl Python 3 none any Details for mpbuild-1.3.0-py3-none-any.whl

Total release size: 377.8 kB

Release files / mpbuild-1.3.0.tar.gz

Download URL mpbuild-1.3.0.tar.gz
Size 355.9 kB
Tags Source
SHA-256 checksum
How to use checksums
028862490cad8b394073e1d32f615b861e72bb51d87f89f0a25b68960fd77883
BLAKE2b-256 checksum
How to use checksums
a1995860c1854e62e2479201f4129d6aef5fab22b0cd03a25e1ac83bcb9b6791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / mpbuild-1.3.0-py3-none-any.whl

Download URL mpbuild-1.3.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe854377416b4fb820930b1675d485085f34c680fa7627ad9d57782a71323c8d
BLAKE2b-256 checksum
How to use checksums
25a06071d1376018004104602dd415d62daf0094c6f0bb6576a5c42dc1310932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for mpbuild 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mpbuild-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page