Micropython deployment toolchain
Project description
microdeploy
Deploy 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.
Features
- Configurable project files and environment - see example config:
microdeploy.yaml
- Workflow support with a consistent CLI and API - see CLI Usage and Python Usage
- Pseudo-caching of MCU filesystem (hash cache)
Purpose
A KISS approach to wrap up existing CLI tools: ampy, terminal-s, (esptool, rshell), and fire.
— Note: Package adafruit-ampy-master
is used
instead of adafruit-ampy
in order to allow upload progress display, because the official package is not up-to-date with master.
Installation
pip uninstall adafruit-ampy # see requirements.txt (this is 0.0.1)
pip install --user microdeploy
microdeploy
microdeploy --help
CLI Usage
microdeploy # With default config file: microdeploy.yaml
microdeploy --port /dev/ttyUSB0 # Without config file
microdeploy --config other.yaml # Use alternate config file
microdeploy --baud 115200 --port XYZ # Override config
microdeploy config
microdeploy config show
microdeploy device
microdeploy device show
microdeploy device ls
microdeploy device put main.py
microdeploy device put test.py main.py
microdeploy device rm main.py
microdeploy device mkdir testdir
microdeploy device rmdir testdir
microdeploy device rmdir . # Note: Remove all files on MCU filesystem.
microdeploy device console
microdeploy package
microdeploy package names
microdeploy package files tests
microdeploy package push tests
microdeploy package push tests --debug --nofail --noput --norun --force
microdeploy package run tests-run.py
microdeploy package cache
microdeploy package cache show
microdeploy package cache refresh
microdeploy package cache clear
Python Usage
from microdeploy import Microdeploy
help(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')
Example
Automation of deploy and run tests on MCU - see code in example/project
.
Push the package (2 times to see the cache working):
python3 -m microdeploy -c example/project/microdeploy.yaml package push tests-run
Deploying package: tests-run: 4 files -> MCU...
Put: example/project/tests/__init__.py
-> tests/__init__.py... 23 bytes
0%, 0.0s, 0 bits/s, 23 bytes left, 0.0s left.
Creating directory: tests
Put: example/project/tests/__init__.py
-> tests/__init__.py... 23 bytes
100%, 0.9s, 209 bits/s, 0 bytes left, 0.0s left.
Put: example/project/tests/test_pin.py
-> tests/test_pin.py... 579 bytes
100%, 1.3s, 3596 bits/s, 0 bytes left, 0.0s left.
Put: example/project/tests/lib/unittest.py
-> tests/lib/unittest.py... 7193 bytes
0%, 0.0s, 0 bits/s, 7193 bytes left, 0.0s left.
Creating directory: tests/lib
Put: example/project/tests/lib/unittest.py
-> tests/lib/unittest.py... 7193 bytes
100%, 5.4s, 10559 bits/s, 0 bytes left, 0.0s left.
Put: example/project/tests-run.py
-> tests-run.py... 55 bytes
100%, 0.9s, 490 bits/s, 0 bytes left, 0.0s left.
Run: tests-run.py...
---8<---------
test_pin_on (TestPin) ... ok
test_pin_off (TestPin) ... ok
test_pin_toggle (TestPin) ... ok
Ran 3 tests
OK
--------->8---
OK: Pushed to MCU 4/4 files from package: tests-run.
Ran on MCU: ['tests-run.py'].
More on asciinema:
Development
This 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 Versioning is followed
-
Stage of development: MVP
-
The smaller the better:
wc -l microdeploy/*
91 microdeploy/cli.py 103 microdeploy/config.py 293 microdeploy/device.py 197 microdeploy/__init__.py 6 microdeploy/__main__.py 77 microdeploy/package.py 767 total
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file microdeploy-0.0.2.tar.gz
.
File metadata
- Download URL: microdeploy-0.0.2.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe4d0ab37909a26ce6e7268ec954b6d7acb1a0a2878fc7895b9a4c0db94c1d8 |
|
MD5 | df9e47f4f954b130acf8afe35ccd5c5d |
|
BLAKE2b-256 | 2bb0e9be3a1439c0a88b858b5c70a50678fcbc7ccc2d83217f0f9bb2d47c72ca |
File details
Details for the file microdeploy-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: microdeploy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6688128d2d67c65cd39cfb905b1407b05c71f81bf99d5f5437dfc75743db69a0 |
|
MD5 | 93272f29a3bdaf561e7dcb4f2256c56b |
|
BLAKE2b-256 | c2549fef129abb8d450be6b7917188279558da60410eff5eaeb02a4a57318689 |