Skip to main content

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
    

Metadata

Release files for microdeploy 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microdeploy 0.0.2
File Size Uploaded Provenance Actions
microdeploy-0.0.2.tar.gz 15.2 kB Without provenance Details for microdeploy-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microdeploy 0.0.2
File Interpreter ABI Platform Actions
microdeploy-0.0.2-py3-none-any.whl Python 3 none any Details for microdeploy-0.0.2-py3-none-any.whl

Total release size: 30.5 kB

Release files / microdeploy-0.0.2.tar.gz

Download URL microdeploy-0.0.2.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3fe4d0ab37909a26ce6e7268ec954b6d7acb1a0a2878fc7895b9a4c0db94c1d8
BLAKE2b-256 checksum
How to use checksums
2bb0e9be3a1439c0a88b858b5c70a50678fcbc7ccc2d83217f0f9bb2d47c72ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / microdeploy-0.0.2-py3-none-any.whl

Download URL microdeploy-0.0.2-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6688128d2d67c65cd39cfb905b1407b05c71f81bf99d5f5437dfc75743db69a0
BLAKE2b-256 checksum
How to use checksums
c2549fef129abb8d450be6b7917188279558da60410eff5eaeb02a4a57318689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for microdeploy 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page