Skip to content

ugit v2.2.0

Latest

Choose a tag to compare

@turfptax turfptax released this 04 Nov 16:57
824aa56

Low-memory OTA updates (#41)

Thanks to @faludi for tracking this down on a Raspberry Pi Pico W.

On boards with little RAM, pull_all() and safe_pull_all() could fail with OSError: [Errno 12] ENOMEM. Whole files were held in memory, sometimes twice over. Hashing, downloads and backups now work in 512-byte chunks, so each file needs about 0.5 KB of memory however big it is.

  • Hashing streams each file instead of reading it all at once. Running out of memory no longer makes a file hash as empty, which used to make unchanged files look changed and download again.
  • Downloads go to a temporary file and replace the original only when finished. If a download fails partway, the existing file stays untouched. An HTTP error such as a 404 now raises an exception instead of writing the error page over your file.
  • Backups also copy in chunks. The backup format is unchanged, so restore() works the same.

SD card protection (#38)

pull_all() no longer deletes files on a mounted SD card. /sd is now protected automatically, like /lib.

Changed

  • pull() now returns the number of bytes written instead of the file contents. pull_all() and update() don't use the return value. If your own code calls pull() directly and uses its result, it needs updating.

Under the hood

  • 81 tests, up from 65 in v2.1, including multi-byte characters split across chunks and failed downloads.
  • CI now tests Python 3.11 and 3.13. Python 3.9 was dropped because it's end-of-life and GitHub's runners no longer have it.

Upgrading

On a device, run ugit.update() and reset. Or reinstall with mip.install("github:turfptax/ugit").