Glad you asked:
Build mpy-cross on your computer:
git clone <https://github.com/micropython/micropython.git>
cd micropython
cd mpy-cross
make
Put the folder with your code inside the build folder
Use mpy-cross to generate .mpy’s from .py files like this:
cd build
mpy-cross PyLora_SX127x_extensions/pyLora.py
Use ampy to “put” .mpy files into the micropython device
ampy --port /dev/tty.usbserial-0001 ls #To check the files
ampy --port /dev/tty.usbserial-0001 put PyLora_SX127x_extensions/pyLora.mpy PyLora_SX127x_extensions/pyLora.mpy # To place pyLora.mpy in folder inside device
More info about how ampy works here:
MicroPython Basics: Load Files & Run Code
$$ \text {Benjamín Arratia - 2026} $$