pydevices-examples utils

August 20, 2026 · View on GitHub

The files in this folder extend the functionality of pydevices-examples. They are not required for the basic functionality of pydevices-examples, but they can be useful for some applications. Some of these files are not written by the author of pydevices-examples, but are included here for convenience. Many of the examples in the examples folder use these files.

Preferred: set PYTHONPATH (CPython) or MICROPYPATH (MicroPython/CircuitPython) to .:lib:utils and run from lib/ — no import needed. This package is optional; example scripts never import utils.path themselves.

Without those env vars (a bare device REPL, or boot.py/main.py on a device that keeps utils/), set up the path explicitly:

import utils.path  # adds cwd, lib/, and utils/ to sys.path

You may instead copy any of the files or directories to a location in your path such as /lib.

Install into a device's utils/:

import mip

mip.install("github:PyDevices/pydevices-examples/packages/utils.json", target="./utils")

Product-owned desktop modules — mip, the micropython shim, frame_recorder — live in pydevices utils/ instead, and are installed by pydevices-desktop.

Notable modules

ModulePurpose
framebuf.pyThe framebuf API on CPython and CircuitPython
displaybuf.pyPeter Hinch's DisplayBuffer API
keypins.pyPresents key events as pin-like objects
wifi.pyMicroPython network.WLAN shim used by the examples
viper_tools.pyOptional MicroPython Viper accelerators
console.pyScrolling character terminal; an os.dupterm target that mirrors the REPL onto a display
lv_encoder_emu.pyDesktop-only soft encoder on a secondary surface, standing in for MCU machine.Encoder / rotaryio (see examples/lv_multi_display.py)
tft_text.py, tft_write.py@russhughes font rendering
png.pyExperimental PNG support
color_setup.py, hardware_setup.py, touch_setup.py, fetch_ph_gui.pyPeter Hinch GUI integration

gui/ is an upstream Peter Hinch tree fetched on demand and gitignored — one of nano / micro / touch at a time. See peterhinch-guis.md.

pdwidgets/ and palettes/ moved out to their own repositories: pdwidgets, palettes.

Many scripts in lib/examples/ depend on these modules. They are excluded from the MIP packages — install from GitHub only. Some files are third-party ports included for convenience; see the file headers for attribution.