Skip to content

wifi.py belongs in pydevices/lib/, not pydevices-examples — a board needs it before the network works #29

Description

@bdbarnett

Brad, 2026-09-09: "wifi.py lives in pydevices-examples, but may have a better home in pydevices, either in lib/ or utils/."

Recommendation: pydevices/lib/, not utils/.

pydevices/utils/README.md is explicit that that directory is for "Desktop utility modules", automatically included in the pip and MIP pydevices-desktop packages — mip.py, micropython.py, frame_recorder.py, usdl2.py, uwin32.py. wifi.py is the opposite kind of thing: it connects a board to a network. It belongs with appdev, displaydev, events, keys, boarddev and multimer in lib/, which is what the pydevices MIP package installs onto a board.

This does NOT remove the hand-copy step, and it cannot. Brad's correction, and it is worth stating plainly because the first version of this issue got it wrong: wifi.py is what gets you onto the network, and mip needs the network to install pydevices. Chicken and egg. Moving the file changes nothing about a fresh board, which still needs wifi.py and secrets.py copied over serial before anything can be fetched.

Where the payoff actually is: freezing. At some point the pydevices package is likely to be frozen into the firmware, and then wifi.py is simply present on every board from first boot — no copy, no install, the bring-up sequence starts at "connect". That only happens if the file lives in pydevices/lib/ rather than in an examples repo the firmware build never looks at. So this is a small move made now so a later change pays off automatically, not a fix for today's friction.

The taxonomic argument stands on its own regardless: a board network helper is not a desktop utility, and it is currently in neither of the right places.

Note the asymmetry with secrets.py. That one should stay out of any package and out of any frozen image: it holds credentials and is per-user. pydevices-examples/lib/utils/secrets.py is a desktop shim reading environment variables, and on a board it is replaced by two literal assignments. So even after freezing, the bring-up guide still has to tell people to write their own secrets.py — one copied file instead of two.

What moving it involves: relocate pydevices-examples/lib/utils/wifi.py to pydevices/lib/wifi.py, confirm it does not import anything desktop-only, keep a shim or update the examples that import it, and update the bring-up docs.

Related: #28 (the bring-up documentation), and whatever issue eventually carries the freeze-pydevices-into-firmware work — this is a prerequisite for the wifi.py half of that paying off.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions