Package: microdeploy
microdeployDeploy project files on MCU as simple, fluid, and configurable.This tool gives a per-project approach for uploading files to MCU.
Per-environment support is intended - todo.FeaturesConfigurable project files and environment - see example config:microdeploy.yamlWorkflow support with a consistent CLI and API - seeCLI UsageandPython UsagePseudo-caching of MCU filesystem (hash cache)PurposeA KISS approach to wrap up existing CLI tools:ampy,terminal-s,
(esptool, rshell),
andfire.—Note: Packageadafruit-ampy-masteris used
instead ofadafruit-ampyin order to allow upload progress display, because the official package is not up-to-date withmaster.Installationpipuninstalladafruit-ampy# see requirements.txt (this is 0.0.1)pipinstall--usermicrodeploymicrodeploymicrodeploy--helpCLI Usagemicrodeploy# With default config file: microdeploy.yamlmicrodeploy--port/dev/ttyUSB0# Without config filemicrodeploy--configother.yaml# Use alternate config filemicrodeploy--baud115200--portXYZ# Override configmicrodeployconfigmicrodeployconfigshowmicrodeploydevicemicrodeploydeviceshowmicrodeploydevicelsmicrodeploydeviceputmain.pymicrodeploydeviceputtest.pymain.pymicrodeploydevicermmain.pymicrodeploydevicemkdirtestdirmicrodeploydevicermdirtestdirmicrodeploydevicermdir.# Note: Remove all files on MCU filesystem.microdeploydeviceconsolemicrodeploypackagemicrodeploypackagenamesmicrodeploypackagefilestestsmicrodeploypackagepushtestsmicrodeploypackagepushtests--debug--nofail--noput--norun--forcemicrodeploypackageruntests-run.pymicrodeploypackagecachemicrodeploypackagecacheshowmicrodeploypackagecacherefreshmicrodeploypackagecacheclearPython UsagefrommicrodeployimportMicrodeployhelp(Microdeploy)Without config file:deploy=Microdeploy(port='/dev/ttyUSB0')deploy.config.show()deploy.device.ls()deploy.device.put('main.py')deploy.device.put('lib.py','/lib/lib.py')deploy.device.run('sandbox/test-something.py')deploy.device.reset()With config file (relative to cwd):deploy=Microdeploy(config='microdeploy.yaml')deploy.package.show('tests')deploy.package.files('tests')deploy.package.push('tests')ExampleAutomation of deploy and run tests on MCU - see code inexample/project.Push the package (2 times to see the cache working):python3-mmicrodeploy-cexample/project/microdeploy.yamlpackagepushtests-runDeployingpackage:tests-run:4files->MCU...Put:example/project/tests/__init__.py->tests/__init__.py...23bytes0%, 0.0s, 0 bits/s, 23 bytes left, 0.0s left.Creating directory: testsPut: example/project/tests/__init__.py-> tests/__init__.py... 23 bytes100%,0.9s,209bits/s,0bytesleft,0.0sleft.Put:example/project/tests/test_pin.py->tests/test_pin.py...579bytes100%, 1.3s, 3596 bits/s, 0 bytes left, 0.0s left.Put: example/project/tests/lib/unittest.py-> tests/lib/unittest.py... 7193 bytes0%,0.0s,0bits/s,7193bytesleft,0.0sleft.Creatingdirectory:tests/libPut:example/project/tests/lib/unittest.py->tests/lib/unittest.py...7193bytes100%, 5.4s, 10559 bits/s, 0 bytes left, 0.0s left.Put: example/project/tests-run.py-> tests-run.py... 55 bytes100%,0.9s,490bits/s,0bytesleft,0.0sleft.Run:tests-run.py...---8<---------test_pin_on(TestPin)...oktest_pin_off(TestPin)...oktest_pin_toggle(TestPin)...okRan3testsOK--------->8---OK:PushedtoMCU4/4filesfrompackage:tests-run.RanonMCU:['tests-run.py'].More on asciinema:Device accessCache managementConfiguration managementPackage managementDevelopmentThis prototype was written because I was tinkering with ESP in a project with multiple files.
I was tired of forgetting to upload this or that file, and testing partly outdated code,or needing to upload all files again every time. It became worse when I had to test my project on both ESP32 and 8266.Project facts:Semantic Versioningis followedStage of development:MVPThe smaller the better:wc -l microdeploy/*91microdeploy/cli.py103microdeploy/config.py293microdeploy/device.py197microdeploy/__init__.py6microdeploy/__main__.py77microdeploy/package.py767total