
Recall first from The quality gate and the end-to-end run
- subprocess.run(timeout=...) kills the child and raises TimeoutExpired, while a pyserial read timeout returns a short or empty read you must check yourself
- Idempotent steps detect device state first and write the state marker only after the step is verified
- [project.scripts] in pyproject.toml makes pip generate the devkit command when the wheel is installed
Preparing the demo: one story on a fresh board
3 min readIn the previous lesson you ran devkit end to end and passed the quality gate. This lesson prepares the demo narrative from flash to report, handles failures live and checks every acceptance criterion from the brief.
Most failed demos do not fail because the code is broken. They fail because the board is in an unknown state: someone provisioned it yesterday, a config file survived a reflash, an SSH key is already in place. The demo then "works", but it proves nothing, because the audience cannot tell your tooling apart from your manual fixes. The cure is the a board whose storage was re-imaged immediately before the demo, so no configuration or data from earlier runs survives. For a Raspberry Pi 4 or 5 that means writing the image to the SD card again, exactly as the flashing lesson taught, and booting it before the audience. Say out loud that the card was just re-imaged: that sentence is what turns a run into evidence.
Write a runbook before you touch the board. A runbook is one page listing every command in order, what the audience should see after each one, and what you will do if it fails. Rehearse it at least twice: once slowly, reading every output, and once at demo speed with a timer. The rehearsal is where you discover that provisioning needs the board's new IP address, or that the test suite takes longer than your slot allows.
List the story beats: fresh card, flash, provision, test, report, rubric. One beat per subcommand, plus the opening and the close.
Write the exact commands: copy them from your end-to-end run, not from memory. Include the working directory and any environment variables.
Name the evidence per beat: the log line, the exit code, or the artifact the audience will see. A beat without evidence is a claim, not a demo.
Plan the failure path: for each beat, one sentence on what you say and do if it fails (below).
Rehearse and time it: two full runs on the real board, adjusting the narrative until it fits the slot.
Record the rehearsal with script(1), which captures everything printed to the terminal into a file:
script -q demo-rehearsal.log
devkit --help
exit
The exit ends the recorded shell. The log file is your fallback: if live hardware misbehaves, you can show the recorded run and say plainly that it is a recording from the rehearsal, with its date. Values and timings in your log will differ from anyone else's; that is expected.
Handling failures live is a skill the rubric rewards, not a disaster. The rules: narrate what you see ("the flash step returned non-zero"), read the actual error from the log instead of guessing, form one hypothesis and check it, and allow yourself one bounded retry. Do not edit code live. If the retry fails, switch to the recorded run, state which criterion is therefore unverified today, and move on. A calm, honest failure with a diagnosis scores better than a silent retry loop.
Live edits invalidate the quality gate you passed in the previous lesson: the code on screen is no longer the code that was linted, typed and tested. Fixes belong to the next lesson, "The code review and the fixes". In the demo, diagnose and record; do not patch.
Demonstrating every subcommand
3 min readThe demo walks the four subcommands from the CLI lesson in pipeline order. For each one you show three things: the interface, the run, and the evidence. Start with devkit --help, then devkit flash --help and the same for the others. The --help text is generated by argparse, so it always exists, and it lets the audience see the whole tool in ten seconds before you run anything.
Flash. State which image you are writing and to which device, using the options your brief defines. Point at the verification step from the flashing lesson (the read-back or checksum comparison) as it prints: writing bytes is easy, proving the card holds them is the feature. If the flash is slow, narrate what the tool is doing rather than filling silence; the time keyword in bash (time devkit flash ...) gives you real, user and sys figures you can quote, and you will reuse those figures in the trade-off section.
Provision. The board has booted the fresh image and is reachable over the network. Show the reachability check first, then run devkit provision and show its effect on the board: the configuration applied, verified over the SSH path from the provisioning lesson. The key sentence: "the card was re-imaged, so anything you see on the board now was put there by this command."
Test. Run the board-in-the-loop suite against the freshly provisioned board. Capture the output while keeping the exit status honest:
set -o pipefail
devkit test 2>&1 | tee test-run.log
echo $?
Without pipefail, a pipeline returns the exit status of its last command, which is tee, and tee almost always succeeds. In a real test false | tee x.log printed status 0 with the default settings and 1 after set -o pipefail. A failing test suite would print failures and still report 0. With set -o pipefail, the pipeline fails if devkit test fails, and echo $? shows it. On a passing run you see 0; the count of tests and the timing on your machine will differ.
Report. Run devkit report and open the artifact it produces. Do not just show that a file exists: point at one number in the report and trace it back to a line in test-run.log. That trace, from summary to raw evidence, is what separates a report from a decoration.
Acceptance criteria and the rubric
2 min readAn a condition from the project brief that the finished tool must demonstrably satisfy, written so a reviewer can check it is only met when there is evidence. Open the brief from the architecture lesson and build a map with one row per criterion: the criterion's own words, the command that demonstrates it, and the artifact that proves it. "Flashes a fresh board" maps to the live flash plus its verification output. "Produces a reproducible report" maps to the report artifact plus the log line you traced. If a criterion has no row, or a row has no artifact, you have found a gap before the reviewer does.
A a scoring sheet that lists the criteria and dimensions to judge, with a fixed scale, so feedback is comparable between reviewers turns the demo from an opinion into a measurement. A workable rubric for this project scores each brief criterion plus three delivery dimensions (evidence quality, failure handling, trade-off defence) on a simple scale: 0 for not shown, 1 for shown with gaps, 2 for shown with convincing evidence. The scale matters less than the rule that every score names its evidence. "2, because the card was re-imaged on camera and provision's effect was verified over SSH" is feedback you can act on. "Looks good" is not.
Collect feedback with a fixed protocol so it fits the slot: after the run, the reviewer reads the scores aloud, and for each dimension writes one thing to keep and one thing to fix. Write the fixes down verbatim in your notes, including any criterion scored below 2 and any disagreement you have with a score. Do not argue scores during the session; record them. Those notes are the input to the next lesson, where the code review turns them into fixes.
Trade-offs you must defend
3 min readThe rubric's last dimension asks you to defend design decisions with evidence, not preference. Three questions come up for almost every devkit implementation. Prepare an answer for each, backed by something you ran.
Going deeperargparse vs typer
Typer gives you type-hint-driven commands and prettier help output, but it is a third-party package with its own dependency chain, so choosing it adds packages to install, pin and audit. argparse is in the standard library: on a stock Ubuntu 24.04, python3 -c "import argparse" succeeds with nothing installed, while pip show typer lists the dependencies. In a real test on Python 3.12 with typer 0.29.3 it printed Requires: annotated-doc, pydantic, rich, shellingham; older typer releases were built on click, so the exact list depends on the version you pin. Evidence to present: your dependency list from the packaging lesson, and the quality gate's dependency policy. The honest defence of argparse is not "typer is bad"; it is "four subcommands do not justify an extra dependency chain, and the brief values a small, auditable install". If you chose typer, defend it with the concrete ergonomics it bought you and show the pinned versions.
Going deeperSync vs async flashing
Flashing one board is a single sequential stream of writes to one device, bounded by the card and the reader, not by Python. An async rewrite cannot make that one stream faster; concurrency pays when you flash or poll several boards at once, which the brief does not require. Evidence to present: measure your sync flash with the bash time keyword and compare the real time against the device's raw write speed (the same write measured with a plain copy in the flashing lesson). If the tool's wall time is close to the raw write time, Python overhead is not the bottleneck and async would add complexity for nothing. If you did build an async path for multi-board labs, say so and show the two-board numbers; do not claim a single-board speedup you did not measure.
Going deeperMock vs real hardware
Your pytest suite uses hardware fakes from the mocking lesson, and the demo runs on a real board. Both are necessary and neither is sufficient. Fakes prove logic: parsers, retry rules and report formatting run in milliseconds on any machine, including CI without a board. They cannot prove integration: device permissions, udev naming, serial timeouts and actual boot timing only exist on hardware. Evidence to present: your fast mocked suite passing in the quality gate, one concrete bug class a fake could never catch (for example a serial read that times out on real boot delays), and the live board run catching exactly that class. The defence: mocks for speed and coverage, the board for truth, and the demo deliberately on the board because the brief's criteria are about hardware behaviour.
Rehearse these three answers as one minute each, with the artifact or measurement on screen while you talk. A trade-off defence without a number or a file is just an opinion, and the rubric scores it 0.
You now have a runbook, a recorded rehearsal, a criteria map and three evidenced trade-off answers. The next lesson, "The code review and the fixes", takes the reviewer's written fixes and your scored rubric and turns them into reviewed code changes, so the demo you just gave becomes the baseline for the final release.
Key takeaways
- A fresh board means a re-imaged card with no leftover state, so the demo proves provisioning rather than manual tweaks
- Without set -o pipefail, a pipeline like devkit test | tee returns tee's exit status and hides test failures
- An acceptance criterion is verified only when a command and its artifact demonstrate it live, not when you claim it
- Typer adds a dependency chain over stdlib argparse, async flashing does not speed up a single board, and mocks cannot prove hardware integration
Reflect
- Explain to a colleague, in two sentences: prepare a demo runbook that walks flash, provision, test and report on a fresh board
- Which objective are you least sure about? Re-read that section.
References and further reading
- Man pagescript(1): make a typescript of a terminal session
- Man pagetee(1): read from standard input and write to standard output and files
- Man pagebash(1): the GNU Bourne-Again shell, including pipefail and the time keyword
Official documentation first. Links checked when the lesson was published.