tidbyt / pixlet

Build apps for pixel-based displays ✨
https://tidbyt.com
Apache License 2.0
756 stars 107 forks source link

Add the ability to read files from Starlark #1045

Closed rohansingh closed 4 months ago

rohansingh commented 4 months ago

Starlark scripts can now load arbitrary files from their bundle and read them using a Python-like open() and read() API. A readall() convenience function is also provided.

The examples have been updated to use this functionality where relevant. For example:

load("icon.png", icon = "file")

BTC_ICON = icon.readall()

Supporting changes:

  1. The pixlet render command can now accept an entire directory containing multiple Starlark files and static resources.

  2. The pixlet private bundle command can now accept an entire directory. It will load the applet contained in the directory, and bundle any files that the applet itself loads. Not that "private" is a misnomer, this command is used by both private and community apps.

  3. App manifests no longer contain a fileName attribute, since an app may contain multiple files. packageName has been removed as well, since it is no longer used for anything.

jmanske commented 4 months ago

Holy smokes @rohansingh

When is this going live? Could be game changer for apps that need to render a lot of images.

rohansingh commented 4 months ago

@jmanske Ideally this week. Agreed, it will be great for images and other assets. The primary motivation is to be able to include audio files for Tidbyt Gen 2.

rohansingh commented 4 months ago

Offline review from @matslina:

Deferred for future PR's: