circup icon indicating copy to clipboard operation
circup copied to clipboard

Only install platforms needed for current device

Open dunkmann00 opened this issue 4 months ago • 0 comments

Rather than installing all the platforms from the global PLATFORMS variable, only install source (py) and the compiled (mpy) version that the currently connected device needs.

This allows some nice improvements:

  1. Only need to download at most, 2 versions of a bundle, not however many exist in PLATFORMS.
  2. A device doesn't NEED the compiled versions. So with this in mind, this change adds the behavior where if a compiled bundle can't be found, it falls back to installing the source version.
  3. Because of 2, a bundle maintainer doesn't have to provide compiled bundles to use their bundles with circup. If only providing source bundles is sufficient, circup is now happy with that. It will check for and try to download a compiled bundle, but if it doesn't find it, it just falls back to the source bundle.
  4. Also because of 2, if someone is using an older version of circuitpython that is no longer getting compiled bundle builds, they can also still use circup. In this case it again falls back to the source bundle (or pin to an older bundle version that does have the compiled bundle for the version of circuitpython being used...circup no longer only supports specific platforms so if a platform bundle exists, it can use it).

What first prompted this was trying to find someone else's circuitpython bundle to test for one of the other PRs I did. I found sparkfun had made one but they hadn't updated it in a while and didn't have the 10.x-mpy platform bundle. Because of that, circup wouldn't even let me add their bundle because it failed to validate successfully. So from that I kinda started to think about it and wonder if there was a different way to go about handling platforms in circup. I figured it was kind of something I could try to play around with and see if I could put something together that made sense/was not too difficult to do. Ultimately, I'm happy with the end result.

But let me know what you think or if you have any questions about it!

dunkmann00 avatar Nov 22 '25 03:11 dunkmann00