Package: upydev
uPydevCommand line tool for MicroPython devicesuPydevis an acronym of 'MicroPythondevice', and it is intended to be a command line tool to make easier the development, prototyping and testing process of devices based on boards running MicroPython. It is intended to be cross-platform and
connection agnostic (Serial, WiFi and Bluetooth Low Energy).Features:Tools to allow configuration, management, communication and control of MicroPython devicesCommand line AutocompletionFile IO operations (upload, download one or multiple files, recursively sync directories...)SHELL-REPL modes: Serial, WiFi (SSL/WebREPL), BLEOTA* Firmware updates WiFi (TCP/SSL), BLE  (* esp32 only)Custom commands for debugging, testing and prototypingCustom tasks yaml files that can be played like ansibleRun tests in device with pytest and parametric tests or benchmarks using yaml filesGroup mode to operate with multiple devicesDocsGetting StartedInstalling :$ pip install upydevor$ pip install --upgrade upydevto update to the latest version availableCreate a configuration file:upydev will use local working directory configuration unless it does not find any or manually indicated with-goption.To save configuration in working directory:$ upydev config -t [DEVICE ADDRESS] -p [PASSWORD/BAUDRATE], where[DEVICE ADDRESS]must be a valid :IP/HOSTNAMESERIAL ADDRESSMAC ADDRESS/ UUIDHostname must be set in device, e.g. in esp32 default isesp32.local-pis set to 115200 by default, so it is not necessary unless using a different baudrateMAC address format will depend on OS system (e.g. Linux uses MAC format 'XX:XX:XX:XX:XX:XX', and macOS uses UUID format 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')e.g.# WiFi$upydevconfig-t192.168.1.53-pmypass# SERIAL$upydevconfig-t/dev/tty.usbmodem387E386731342# BLE$upydevconfig-t9998175F-9A91-4CA2-B5EA-482AFC3453B9Default device name isupydevice, to set a custom name use-@flag as$upydevconfig-t192.168.1.53-pmypass-@mycustomdeviceTo check configurationupydevorupydev check$upydev
Device:mycustomdevice
Address:192.168.1.53,DeviceType:WebSocketDeviceOr to get more information if the device is online$upydev-i
Device:mycustomdevice
WebSocketDevice@ws://192.168.1.53:8266,Type:esp32,Class:WebSocketDevice
Firmware:MicroPythonv1.19.1-285-gc4e3ed964-dirtyon2022-08-12;ESP32modulewithESP32(MAC:30:ae:a4:23:35:64,RSSI:-45dBm)To save configuration globally use-gflag:$ upydev config -t [DEVICE ADDRESS] -p [PASSWORD/BAUDRATE] -ge.g.$upydevconfig-t192.168.1.53-pmypass-gTo save configuration in a global group use-ggflag:$ upydev config -t [DEVICE ADDRESS] -p [PASSWORD/BAUDRATE] -gg -@ mydevicee.g.$upydevconfig-t192.168.1.53-pmypass-gg-@mydevice[Optional]
Useregistercommand to
define a function in~/.bashrcor~/.profile$upydevregister-@mydeviceReload~/.bashrcor~/.profile,  e.g. ($ source ~/.profile)Nowmydevicewill accept any args and pass them to upydev, as well as
autocompletion of args, e.g.$mydevice
Device:mydevice
Address:192.168.1.53,DeviceType:WebSocketDeviceOr if the device is connected.$mydevice-i
Device:mydevice
WebSocketDevice@ws://192.168.1.53:8266,Type:esp32,Class:WebSocketDevice
Firmware:MicroPythonv1.19.1-285-gc4e3ed964-dirtyon2022-08-12;ESP32modulewithESP32(MAC:30:ae:a4:23:35:64,RSSI:-45dBm)To see registered devices do:$upydevlsdevs
Device:mydevice
Address:192.168.1.53,DeviceType:WebSocketDeviceWhich adds thelsdevscommand to~.profiletoo. So after reloading  again:$lsdevs
Device:mydevice
Address:192.168.1.53,DeviceType:WebSocketDeviceFinally to enter device shell-repl mode do:$upydevshl@mydevice
shell-repl@mydevice
WebREPLconnected
WARNING:ENCRYPTIONDISABLEDINTHISMODE

MicroPythonv1.19.1-285-gc4e3ed964-dirtyon2022-08-12;ESP32modulewithESP32
Type"help()"formoreinformation.

-CTRL-ktoseekeybindingsor-htoseehelp-CTRL-stotoggleshell/replmode
-CTRL-xor"exit"toexitesp32@mydevice:~$or if the device is registered:$mydeviceshl
shell-repl@mydevice
WebSecREPLwithTLSv1.2connected
TLSv1.2@ECDHE-ECDSA-AES128-CCM8-128bitsEncryption

MicroPythonv1.19.1-285-gc4e3ed964-dirtyon2022-08-12;ESP32modulewithESP32
Type"help()"formoreinformation.

-CTRL-ktoseekeybindingsor-htoseehelp-CTRL-stotoggleshell/replmode
-CTRL-xor"exit"toexitesp32@mydevice:~$To enable WebSocket over TLS or wss checkWebSocket (ws) / WebSocket Secure (wss) TLSOnce the device is configured see next section or readUsage documentationto check which modes and tools are available.Or if you are working with more than one device continue with thissectionto create a group configuration.uPydev Usage:Requirement:Needs REPL to be accessible(seeGetting Started)Usage:$ upydev [Mode] [options] or upydev [upy command] [options]This means that if the first argument is not a Mode keyword or a
upy command keyword it assumes it is a 'raw' upy command to send to the upy deviceHelp:$ upydev h,$ upydev help,$ upydev -hor$ upydev [command] -hExample: Mode$ upydev put dummy.py,$ upydev get dummy.pyExample: uPy command$ upydev infoExample: Raw commands$ upydev "my_func()"$ upydev 2+1$ upydev "import my_lib;foo();my_var=2*3"To see documentation checkUpydev readthedocs