Utils
August 14, 2026 · View on GitHub
Optional extensions in lib/utils/. Not required for basic display and event use. API docs: Utils Reference.
MCU / host helpers that used to live here (byteswap, viper_tools, mip,
micropython shim, keypins, wifi, frame_recorder) are in
pydevices utils/.
packages/utils.json depends on that tree; a sibling checkout is on
sys.path via path.py.
Install
import mip
mip.install("github:PyDevices/pydevices-examples/packages/utils.json", target="./utils")
Path setup
Preferred: set PYTHONPATH (CPython/CircuitPython) or MICROPYPATH (MicroPython) to .:lib:utils and run from lib/ — no import needed.
When environment variables are unavailable or not set as recommended (for example, a bare device REPL, or boot.py/main.py), put lib/ and utils/ on sys.path explicitly:
import utils.path
Or copy the utils modules into lib/ on your device.
Notable modules
| Module | Purpose |
|---|---|
framebuf.py | framebuf API on CPython/CircuitPython |
displaybuf.py | Peter Hinch DisplayBuffer API |
console.py | Terminal-style console widget |
lv_encoder_emu.py | Desktop-only soft encoder UI on a secondary surface (stand-in for MCU machine.Encoder / rotaryio); see examples/lv_multi_display.py |
pdwidgets/ | Moved to pdwidgets — user guide |
palettes/ | Moved to palettes — user guide |
tft_text.py, tft_write.py | russhughes font rendering |
png.py | PNG support (experimental) |
Third-party trees copied locally (not in utils.json):
| Path | Purpose |
|---|---|
gui/ | Peter Hinch GUIs — install via fetch_ph_gui; gitignored; one of nano / micro / touch at a time |
Many examples in lib/examples/ depend on utils. They are excluded from the MIP packages — install from GitHub only.
Some files are third-party ports included for convenience; see file headers for attribution.