Pin the device's pip packages and drop pytest from the image #115

Merged
aluminum-ice merged 1 commit from build/pin-device-pip into main 2026-10-31 05:20:04 +00:00
Owner

What this PR does

Makes the image install a known set of Python packages instead of whatever is newest on build day, and stops shipping pytest on the device.

  • pip.local.constraints (in builder/config.yml vars:) holds an exact version for each of the 35 packages pip.local.install brings in. A new task writes them to /home/pi/.venv/kestrel-constraints.txt, and the background venv install passes it with -c. The versions are a 1.0.10 device's pip freeze --local, so 1.0.11 installs the set that has already run on hardware. torch==2.10.0 stays pinned in the install list as before.
  • pytest is dropped from pip.local.install, along with what only it needed (iniconfig, pluggy, packaging, Pygments). Nothing shipped imports them; the tests run on the build host and in CI.
  • Docs: the README package table and its intro, the CLAUDE.md pip-packages note (how to add a package with its pins), and the Makefile's test comment.

Checklist

  • Lint passes — make lint (ansible --syntax-check, yamllint, shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.
  • Tests pass — make test (the kestrel_pi pytest suite and the real-data check's tests). The Test workflow runs this on the PR.
  • Nothing real: no secrets, no personal information, no real data. This is a public repository. The diff contains no real account passwords or hashes, Wi-Fi passphrases, private keys, API tokens, .env files, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you.
  • Consent gates intact. Capture and network plugins still ship disabled, enabling them still takes the authorized-use acknowledgment (never pre-ticked or given by code), and the capture whitelist is still enforced.
  • Docs updated in the same PR, if this changes something an operator sees or configures: the README package table, the relevant page under docs/, and the on-device operator guide (GUIDE_MD in kestrel_pi/userguide.py) where it applies.
  • Commit messages are short and imperative.

Release impact

  • App-layer-safe — changes only files the in-place update engine carries: the kestrel_pi package, plugins/*.py, systemd units, the journald drop-in, a lib script already in the engine's LIB_SCRIPTS, or the CLI.
  • Reflash-class — touches a build input the engine does not carry onto a running device: apt or pip packages, boot options / config.txt / cmdline, kernel modules, the base image or partition size, builder/config.json, builder/config.yml, the Makefile, .forgejo/workflows/, a shipped config default (config.toml / default.conf), or a brand-new lib script.

Notes for review

  • Checked off-device: walking each pinned package's declared dependencies for Python 3.11 on Linux/aarch64 needs exactly these 35 packages, every dependency is satisfied by its pin, all of them have wheels on PyPI, and none needs a newer Python. make lint passes and the constraints render one per line.
  • Resolved on a 1.0.10 device too, with its own Python 3.11 and a current pip (PyPI only, binary wheels, --dry-run in a throwaway venv): it would install exactly the 35 pinned packages at their pinned versions. The 1.0.11-beta.1 build is the first real install.
  • The new copy task adds about 3 s under QEMU; it runs before the background install, so nothing waits on the venv in between.
  • Changing a pin later: edit pip.local.constraints, and check the set still resolves for Python 3.11 on aarch64 (CLAUDE.md says how).

🤖 Generated with Claude Code

## What this PR does Makes the image install a known set of Python packages instead of whatever is newest on build day, and stops shipping `pytest` on the device. - **`pip.local.constraints`** (in `builder/config.yml` `vars:`) holds an exact version for each of the 35 packages `pip.local.install` brings in. A new task writes them to `/home/pi/.venv/kestrel-constraints.txt`, and the background venv install passes it with `-c`. The versions are a 1.0.10 device's `pip freeze --local`, so 1.0.11 installs the set that has already run on hardware. `torch==2.10.0` stays pinned in the install list as before. - **`pytest` is dropped** from `pip.local.install`, along with what only it needed (`iniconfig`, `pluggy`, `packaging`, `Pygments`). Nothing shipped imports them; the tests run on the build host and in CI. - Docs: the README package table and its intro, the CLAUDE.md pip-packages note (how to add a package with its pins), and the Makefile's `test` comment. ## Checklist - [x] **Lint passes** — `make lint` (ansible `--syntax-check`, `yamllint`, `shellcheck --severity=error`, and the real-data check). The **Lint** workflow runs this on the PR. - [x] **Tests pass** — `make test` (the `kestrel_pi` pytest suite and the real-data check's tests). The **Test** workflow runs this on the PR. - [x] **Nothing real: no secrets, no personal information, no real data.** This is a public repository. The diff contains no real account passwords or hashes, Wi-Fi passphrases, private keys, API tokens, `.env` files, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you. - [x] **Consent gates intact.** Capture and network plugins still ship disabled, enabling them still takes the authorized-use acknowledgment (never pre-ticked or given by code), and the capture whitelist is still enforced. - [x] **Docs updated in the same PR**, if this changes something an operator sees or configures: the README package table, the relevant page under `docs/`, and the on-device operator guide (`GUIDE_MD` in `kestrel_pi/userguide.py`) where it applies. - [x] Commit messages are short and imperative. ## Release impact - [ ] **App-layer-safe** — changes only files the in-place update engine carries: the `kestrel_pi` package, `plugins/*.py`, systemd units, the journald drop-in, a lib script already in the engine's `LIB_SCRIPTS`, or the CLI. - [x] **Reflash-class** — touches a build input the engine does not carry onto a running device: apt or pip packages, boot options / `config.txt` / `cmdline`, kernel modules, the base image or partition size, `builder/config.json`, `builder/config.yml`, the `Makefile`, `.forgejo/workflows/`, a shipped config default (`config.toml` / `default.conf`), or a brand-new lib script. ## Notes for review - Checked off-device: walking each pinned package's declared dependencies for Python 3.11 on Linux/aarch64 needs exactly these 35 packages, every dependency is satisfied by its pin, all of them have wheels on PyPI, and none needs a newer Python. `make lint` passes and the constraints render one per line. - Resolved on a 1.0.10 device too, with its own Python 3.11 and a current pip (PyPI only, binary wheels, `--dry-run` in a throwaway venv): it would install exactly the 35 pinned packages at their pinned versions. The 1.0.11-beta.1 build is the first real install. - The new `copy` task adds about 3 s under QEMU; it runs before the background install, so nothing waits on the venv in between. - Changing a pin later: edit `pip.local.constraints`, and check the set still resolves for Python 3.11 on aarch64 (CLAUDE.md says how). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pin the device's pip packages and drop pytest from the image
All checks were successful
Test / test (pull_request) Successful in 23s
Lint / lint (pull_request) Successful in 34s
Test / test (push) Successful in 24s
Lint / lint (push) Successful in 34s
e5c0639b19
Hold every package the venv install brings in to the versions a 1.0.10
device runs, through a pip constraints file written from
pip.local.constraints. pytest is no longer installed on the device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch build/pin-device-pip 2026-10-31 05:20:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aluminum-ice/kestrel!115
No description provided.