Skip to content

Env helpers move from displaydev to boarddev (a hard break) - #131

Merged
bdbarnett merged 2 commits into
mainfrom
env-to-boarddev
Oct 8, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
env-to-boarddev

Conversation

@bdbarnett

@bdbarnett bdbarnett commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

env_get, env_int, env_float, env_bool and env_set (with _env_raw and the env_set override table) move from displaydev to boarddev. This is a hard break: there is no re-export and no shim, so from displaydev import env_get raises ImportError after this merges. Write from boarddev import env_get instead.

displaydev still reads PYDEVICES_FPS, PYDEVICES_FPS_PRINT and PYDEVICES_REFRESH_MS, through boarddev, imported inside the two methods that read them so the names never appear on displaydev. boarddev still imports nothing at module scope, so there's no cycle.

Every caller in this repo moves with it: the desktop, pgdisplay, psdisplay and linux_kms board configs, displaydev.auto, the tests, docs/board-configs.md, docs/displaydev.md, docs/newcomers.md and lib/audiodev/README.md. tests/test_env.py now also proves the break: every moved name is gone from displaydev and from __all__, and importing it from there fails. test_standalone copies boarddev.py beside displaydev, because a driver reads its settings from there when it starts.

Merge order

Merge this first, then merge the caller PRs below in the same sitting. A caller importing from boarddev needs this pydevices.

  1. this PR
  2. Env helpers come from boarddev (follows pydevices#131's hard break) pydevices-examples#183: examples, utils, tools, typings
  3. Local-module debug builds shadow boarddev with displaydev android-template#17: --local-modules builds shadow boarddev too
  4. webassembly manifest: a page sets the panel size with boarddev.env_set micropython-pydevices#51: a comment only
  5. docs/lvgl.md: Using LVGL with PyDevices moves here from lvgl-bindings #132 (the LVGL page moving here from lvgl-bindings) uses boarddev.env_set, so it goes after this one.

These four wait for a rebuild because they run a frozen pydevices:

What breaks, and until when

pydevices ships to people in three ways, and each one picks this up at a different time. Here's what's broken between steps:

  • From pydevices main (the PyScript pages fetch pydevices-desktop.toml from main; the examples CI checks out main): this changes the moment it merges. Old examples that import from displaydev break there until the examples PR merges, which is why both go in one sitting.
  • From a release (TestPyPI wheels, the mip index): this changes at the next pydevices release. Until then, a venv or board with the released pydevices can't run the new examples, because its boarddev has no env_*.
  • Frozen (bin/micropython and the other desktop interpreters, the vendored wasm in PyDevices.github.io and workbench, the mpvst engine, firmware built with --modules pydevices): this changes at the next pin move and rebuild. Nothing in this PR builds them. Until the rebuild, bin/micropython runs the new examples against its frozen old boarddev and fails. So does the examples gallery on pydevices.github.io (it boots the site's vendored wasm), for the examples that set or read env vars: car_cluster, drum_machine, spectrum, roku_remote, lv_test_timer and the Peter Hinch page.

Tested

  • Scoped tests, run from tests/: test_env, test_boarddev, test_standalone, test_autodisplay, test_desktop_board_config, test_displaydev_fps, test_refresh_override, test_lvgl_display_driver, test_portability, test_display_driver, test_displaydev_capabilities, test_backend_isolation, test_displaydev_auto, test_contract_proof, test_board_peripherals_desktop, test_appdev, test_appdev_timers, test_board_peripherals_static, test_needs_refresh, test_pgdisplay_frame_recorder, test_psdisplay_scale, test_wasm_backends, test_wasm_cli, test_desktop_scale, test_displaydev_lifecycle. 169 tests pass.
  • tests/portability_probe.py under unix MicroPython 1.29 and CircuitPython 10.x, with this lib/ on the path, prints PORTABILITY OK, env checks included.
  • The hard break on CPython, MicroPython 1.29 and CircuitPython: from displaydev import env_get raises ImportError, hasattr(displaydev, "env_get") is False, and boarddev.env_set/env_int round-trip.
  • Real runs, with this branch and the examples branch: lv_test_timer.py kit with PYDEVICES_LV_ROTATION=90 PYDEVICES_REFRESH_MS=50 on MicroPython 1.29 and CPython. It rotates to 90 and reports fps 20.0, so displaydev read the period through boarddev. spectrum.py with PYDEVICES_FPS_PRINT=1 prints its fps line on both.

env_get, env_int, env_float, env_bool and env_set, with _env_raw and the
env_set override table, now live in lib/boarddev.py. displaydev keeps no
copy and no re-export: from displaydev import env_get raises ImportError.
displaydev reads PYDEVICES_FPS, PYDEVICES_FPS_PRINT and PYDEVICES_REFRESH_MS
through boarddev, imported where they are read. boarddev still imports
nothing at module scope, so there is no cycle.

Every caller in this repo moves with it: the desktop, pgdisplay, psdisplay
and linux_kms board configs, displaydev.auto, the tests and the docs.
@bdbarnett
bdbarnett merged commit 226ca10 into main Oct 8, 2026
3 checks passed
@bdbarnett
bdbarnett deleted the env-to-boarddev branch October 8, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant