awesome-micropython
awesome-micropython copied to clipboard
Add Belay (Package Manager & computer-device communications)
I'd like to propose adding my project, Belay, to your list! I can open a PR, but I was unsure of what section to put it under. Belay is primarily 2 things:
Allows Easy Computer-Device Communications.
The following code, running on a computer (e.g. with CPython), will toggle an LED on a microcontroller board running micropython. Besides micropython, no prior pre-configuration is required.
import belay
device = belay.Device("/dev/ttyUSB0")
@device.task
def set_led(state):
print(f"Printing from device; turning LED to {state}.")
Pin(25, Pin.OUT).value(state)
set_led(True)
Package Manager
It's been a challenge to get repeatable deployments, and reliable dependency updates. I added a cli tool belay
that is heavily inspired by Poetry.
Basically, micropython dependency URLs can be specified in pyproject.toml
. Running belay update
will fetch and cache those files into the .belay/
folder of your project (this should be committed to git and can be thought of like a lock file). The dependencies and project can then be installed to device via belay install [PORT]
. Hashes of files are compared, so syncs are efficient when only a few changes are made. The CLI has a lot of other actions to aid in development and debugging, but this is the basic use-case.
Here's a very basic project that uses Belay for handling dependencies. Note that in this project, no explicit belay install
needs to be performed since it's automatically handled within main.py
. This also allows for pip-installable libraries/cli to bundle micropython code that can be automatically deployed to micropython microcontrollers.
Nice! A worthy addition 👍
Not sure where to put it either. Maybe it's time for a new section under Development, or time to restructure them.
mpremote
is under Development > Shells > On Host
, but Belay does more than that.
Maybe Development > IDEs
?
What if we were to add a new, top-level category Tools
and move Development > Shells > On Host
contents; many of the tools listed there are either more-than-just-shells, or aren't really shells.
I feel like anything under Development > IDE
must have a GUI as the primary method of interaction.
I think that’s a good suggestion - gut feel agree on the “IDE” thing, it wouldn’t seem like the right spot for Belay to go either.