Host-side CLI for the openbricks MicroPython firmware — flash, list, run, download, and stop code on an openbricks hub over BLE.
Project description
openbricks-dev
Host-side CLI for openbricks hubs — the same UX as pybricks-dev, built on commodity Python tooling (bleak, esptool, mpremote). One tool for flashing, scanning, and (coming) running code over BLE.
Install
Recommended — with pipx so the CLI lands in an isolated venv and avoids the "externally managed environment" error on modern macOS / Linux distros:
pipx install openbricks-dev
Plain pip works too:
pip install openbricks-dev
For development against a repo checkout (editable install):
pipx install --editable tools/openbricks-dev # or: pip install -e tools/openbricks-dev
Any install path pulls in bleak (cross-platform BLE), esptool, and mpremote.
Commands
flash — program a hub
openbricks-dev flash \
--name RobotA \
--port /dev/tty.usbserial-XXXX \
--firmware native/micropython/ports/esp32/build-openbricks_esp32s3/firmware.bin
Writes the firmware image and bakes the hub's BLE advertising name into NVS. --name is mandatory: two hubs with the same name can't be individually addressed over BLE.
Port syntax: /dev/ttyUSB0 (Linux), /dev/cu.usbserial-* (macOS), COM5 (Windows).
Useful flags: --chip esp32s3, --baud 921600, --skip-erase (faster dev loop, keeps stale NVS).
list — scan for hubs
openbricks-dev list [--timeout 5.0] [--all]
Runs a BLE scan and prints every named device found, sorted by RSSI (strongest first). --all includes unnamed devices too.
run — stage and launch; button stops it; client exits on stop
openbricks-dev run -n RobotA examples/hello.py
Stages the script to /program.py (same target as download) and triggers the hub's launcher to execute it immediately. Output streams back to your terminal in real time.
- Button stop. Pressing the hub button while the program runs raises
KeyboardInterruptvia the same launcher pathdownload+button uses. The client sees the clean "stopped by button press" line and exits. - Program completion. When the program finishes (or raises), the client disconnects and exits — same as
pybricks-dev run. - Script persists. Because
runstages to/program.py, the hub can re-run the last program via a button press without another upload.downloadandrundiffer only in whether the client auto-launches after upload.
Stderr (e.g. exception tracebacks) arrives after stdout and is surfaced with a blank-line separator. No paste-mode === echo — raw-paste mode is clean.
stop — interrupt the running program
openbricks-dev stop -n RobotA
Sends a single Ctrl-C byte over the NUS REPL bridge, which MicroPython surfaces as KeyboardInterrupt. Useful when openbricks-dev run has already exited but the hub's still chewing on a long-running user program.
download — stage a script; hub button launches it
openbricks-dev download -n RobotA examples/wander.py
Writes the script to /program.py on the hub. The code does not run automatically. Place your robot, press the program button (GPIO 4), and the program starts. Press again to stop it mid-run — same UX as Pybricks Prime-hub pybricksdev download.
This works because the firmware ships a frozen main.py that:
- Brings BLE + REPL bridge up immediately (so
openbricks-dev run/download/stopare always reachable, even when no program is running). - Instantiates the board's Hub, which wires the BLE-toggle button (short-press on GPIO 5) with LED feedback.
- Watches the program button (GPIO 4) via
openbricks.launcher.run()— a short-press runs/program.py, a second short-press raisesKeyboardInterruptin the running program.
Two separate pins (4 for program, 5 for BLE toggle), each handled by short-press only — no duration-based dispatch.
Pass --path /alt.py to stage at a different filename (if you've written your own main.py that reads from there).
Tests
cd tools/openbricks-dev
PYTHONPATH=. python -m unittest discover -s tests -t .
No real hardware needed — esptool, mpremote, and bleak are mocked.
Project details
Release history Release notifications | RSS feed
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 openbricks_dev-0.9.2.tar.gz.
File metadata
- Download URL: openbricks_dev-0.9.2.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33893f7b0414ebcdc441aa272bd7f93c9f910887468ee98631ae1dc469739521
|
|
| MD5 |
0ed37ecf737dd1296f75945167f45660
|
|
| BLAKE2b-256 |
2ca09bd93af94c2f4fb9ed7a6f8e9e9c0bd119702d7859291e2f07111d773c42
|
Provenance
The following attestation bundles were made for openbricks_dev-0.9.2.tar.gz:
Publisher:
ci.yaml on 1e0ng/openbricks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openbricks_dev-0.9.2.tar.gz -
Subject digest:
33893f7b0414ebcdc441aa272bd7f93c9f910887468ee98631ae1dc469739521 - Sigstore transparency entry: 1360790092
- Sigstore integration time:
-
Permalink:
1e0ng/openbricks@78d867d7ae262fbf2a219974ae6a8e3b6334a8ba -
Branch / Tag:
refs/tags/v0.9.2 - Owner: https://github.com/1e0ng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@78d867d7ae262fbf2a219974ae6a8e3b6334a8ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file openbricks_dev-0.9.2-py3-none-any.whl.
File metadata
- Download URL: openbricks_dev-0.9.2-py3-none-any.whl
- Upload date:
- Size: 19.1 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 |
55d23676e1452e8c15ee2c242c9ae0e893f0fe6783d1824868c076a222a87dbf
|
|
| MD5 |
ddf5802c37f488f6c409c4196a8e205c
|
|
| BLAKE2b-256 |
67a70c9a99d10f1460a96b1d2c36eb302ef795335322a303bccd41d76cc47da5
|
Provenance
The following attestation bundles were made for openbricks_dev-0.9.2-py3-none-any.whl:
Publisher:
ci.yaml on 1e0ng/openbricks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openbricks_dev-0.9.2-py3-none-any.whl -
Subject digest:
55d23676e1452e8c15ee2c242c9ae0e893f0fe6783d1824868c076a222a87dbf - Sigstore transparency entry: 1360790172
- Sigstore integration time:
-
Permalink:
1e0ng/openbricks@78d867d7ae262fbf2a219974ae6a8e3b6334a8ba -
Branch / Tag:
refs/tags/v0.9.2 - Owner: https://github.com/1e0ng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@78d867d7ae262fbf2a219974ae6a8e3b6334a8ba -
Trigger Event:
push
-
Statement type: