Skip to main content

Tracking Progress in Long CircuitPython Library Updates

A clear position counter makes long library updates easier to follow, even when items are skipped or fail.

Updated 3 min readMarkdown
Part of seriesOpen-Source Contributions
Tracking Progress in Long CircuitPython Library Updates

Circup now shows each module’s position in the update list, making long update runs easier to follow.

CircuitPython is Python for microcontrollers. Adafruit and other contributors publish libraries that let a board use sensors, displays, motors, and other hardware without every project having to write those drivers from scratch. Circup is the command-line tool that installs and updates those libraries.

When a project has many libraries installed, circup update --all can take a while. Circup already printed a line when each update succeeded, but the output did not show how far through the planned work it had reached. A list of names told me what had finished, not where I was in the list.

Figure 1. Circup displays the current module position and total update count in terminal output.

Figure 1. The progress indicator reports a module's position in the pending update list.

The change

The update command now numbers each successful update by its position in the list of modules that need work. For example:

5/389 Updated adafruit_gps

The implementation uses the list that Circup has already built:

for index, module in enumerate(modules_to_update, start=1):
    ...
    click.echo(f"{index}/{len(modules_to_update)} Updated {module.name}")

If there are n modules to update, the displayed position i is in the range 1 ≤ i ≤ n.

This is a list position, not a count of successful updates. The index advances through the planned list even if an earlier item is skipped or fails. That keeps later messages tied to the same module position rather than making the count look like a success tally.

Why a small counter helps

During a long update, the operator can estimate how much of the original work list remains. The counter also gives a quick way to relate terminal output to a log or a reported failure. The command still updates the same modules in the same order, and the counter does not change success or failure behavior.

The implementation stays in the existing loop. It does not add a progress-bar dependency, keep a second count, or alter module selection. The total comes directly from modules_to_update, so the numerator and denominator describe the same work list.

Review and merge

I submitted this change as @shaxntanu. @FoamyGuy reviewed the behavior, suggested dropping a standalone test that was not needed, and later approved the updated PR. @FoamyGuy merged the contribution into Adafruit’s Circup repository.

Validation

During review, the maintainer asked to drop the standalone test case, so the final diff keeps the implementation in the existing update loop. The PR’s validation notes report a targeted CLI check, and the hosted GitHub Actions test job passed. The full local Windows run reported 65 passing tests and five failures in unchanged path-format and CLI/network-sensitive tests.

The contribution was merged in Adafruit Circup PR #291, fixing issue #273.

What I took away

A useful progress indicator does not need to own the update process. Reusing the order already present in the program made the output clearer with a small change and without changing what Circup updates.

References

About the author

  • Tech enthusiast, interested in ECE and other multidisciplinary projects.

No comments yet. Be the first to comment.

Open-Source Contributions

Part 5 of 6

A place where I write about my open-source contributions, the stuff I worked on, the bugs I ran into, what I learned, and how the whole process actually went. Basically the story behind the PR, not just the green merged badge.

Up nextWhen a CircuitPython Module Becomes a Package: Fixing Circup UpdatesHow Circup handles an update when a single-file module becomes a package directory.