When a CircuitPython Module Becomes a Package: Fixing Circup Updates
How Circup handles an update when a single-file module becomes a package directory.

When an installed CircuitPython library changes from a single module file into a package directory, Circup has to replace the old file with the new package.
Circup installs and updates libraries from the CircuitPython bundle. A library can be distributed as one module, such as foo.py, or as a package directory containing __init__.py and related modules.
That creates an update edge case: a library that was installed as a single file can later be reorganized as a package. The update needs to remove the old file and copy the package directory into place.
Figure 1. File-to-package transition handled by Circup: the prior module file is replaced by the library's package directory.
The file-to-package transition
A simplified example is:
Before: adafruit_emc2101.py
After: adafruit_emc2101/
The names still refer to the same library, but the filesystem object has changed from a file to a directory. An updater that keeps resolving the old bundle path can try to handle the package as if it were still a file.
What the pull request changes
Adafruit Circup PR #290 updates path resolution so Circup can install a package after the old single-file module is removed. The change covers both the local disk backend and the Web Workflow backend.
The requested update can still use Circup’s existing command:
circup install --update adafruit_emc2101
The fix is intended to handle the transition without changing how users choose or install libraries.
Regression coverage
The review discussion asked for tests to use a real package from the bundle rather than a mocked empty module. The revised tests use adafruit_emc2101, create the old single-file form on the test device, run the update, and check that the old file is replaced by the package. The disk and Web Workflow paths are both covered.
The PR description reports four focused Windows regression cases passing, 68 passing tests, and five failures in unchanged tests during the full Windows suite. It lists Linux CI as pending. These results come from the PR description and were not independently rerun for this article.
Review status
As of 29 November 2026, PR #290 remains open and unmerged. The revised tests use the real adafruit_emc2101 package to cover both disk and Web Workflow paths, as requested in review. The current PR description lists Linux CI as pending. This article describes work under review, not an accepted or released change. The issue linked from the pull request is #100.
References
About the author
- Tech enthusiast, interested in ECE and other multidisciplinary projects.
Comments
Join the discussionNo comments yet. Be the first to comment.
Open-Source Contributions
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.





