microdeploy


Namemicrodeploy JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/damiencorpataux/microdeploy
SummaryMicropython deployment toolchain
upload_time2023-09-14 13:18:13
maintainer
docs_urlNone
authorDamien Corpataux
requires_python
licenseMIT
keywords micropython deploy deployment microcontroller mcu serial ampy rshell picocom console cache caching
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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`](example/project/microdeploy.yaml)
- Workflow support with a consistent CLI and API - see [CLI Usage](#cli-usage) and [Python Usage](#python-usage)
- Pseudo-caching of MCU filesystem (hash cache)


Purpose
-------

A KISS approach to wrap up existing CLI tools:
[ampy](https://pypi.org/project/adafruit-ampy-master/),
[terminal-s](https://pypi.org/project/terminal-s/),
(esptool, rshell),
and [fire](https://pypi.org/project/fire/).

— *Note: Package [`adafruit-ampy-master`](https://pypi.org/project/adafruit-ampy-master/) is used
instead of [adafruit-ampy](https://pypi.org/project/adafruit-ampy/)
in order to allow upload progress display, because the official package is not up-to-date with [master](https://github.com/damiencorpataux/ampy).*


Installation
------------

```s
pip uninstall adafruit-ampy  # see requirements.txt (this is 0.0.1)
pip install --user microdeploy
```
```s
microdeploy
microdeploy --help
```


CLI Usage
---------

```s
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
------------

```py
from microdeploy import Microdeploy

help(Microdeploy)
```

Without config file:
```py
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):
```py
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`](example/project).

Push the package (2 times to see the cache working):
```s
python3 -m microdeploy -c example/project/microdeploy.yaml package push tests-run
```
```s
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:

- [Device access](https://asciinema.org/a/v0fogxAifNFMB7WoQG7nCVc6Q)

- [Cache management](https://asciinema.org/a/UTXTudQKR9ewKX0VzJLh7dVHz)

- [Configuration management](https://asciinema.org/a/q2KcZO7ilcrjLbYrB4NlPprFm)

- [Package management](https://asciinema.org/a/oPRYVrOjRq2mXGL6AFCIRKadr)


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,
<br>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](https://semver.org/) is followed

* Stage of development: [MVP](https://en.wikipedia.org/wiki/Minimum_viable_product)

* The smaller the better:
   ```wc -l microdeploy/*```
   ```s
    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
   ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/damiencorpataux/microdeploy",
    "name": "microdeploy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "micropython,deploy,deployment,microcontroller,mcu,serial,ampy,rshell,picocom,console,cache,caching",
    "author": "Damien Corpataux",
    "author_email": "d@mien.ch",
    "download_url": "https://files.pythonhosted.org/packages/2b/b0/e9be3a1439c0a88b858b5c70a50678fcbc7ccc2d83217f0f9bb2d47c72ca/microdeploy-0.0.2.tar.gz",
    "platform": null,
    "description": "microdeploy\n===========\n\n**Deploy project files on MCU as simple, fluid, and configurable.**\n\nThis tool gives a per-project approach for uploading files to MCU.\nPer-environment support is intended - todo.\n\n\nFeatures\n--------\n\n- Configurable project files and environment - see example config: [`microdeploy.yaml`](example/project/microdeploy.yaml)\n- Workflow support with a consistent CLI and API - see [CLI Usage](#cli-usage) and [Python Usage](#python-usage)\n- Pseudo-caching of MCU filesystem (hash cache)\n\n\nPurpose\n-------\n\nA KISS approach to wrap up existing CLI tools:\n[ampy](https://pypi.org/project/adafruit-ampy-master/),\n[terminal-s](https://pypi.org/project/terminal-s/),\n(esptool, rshell),\nand [fire](https://pypi.org/project/fire/).\n\n&mdash; *Note: Package [`adafruit-ampy-master`](https://pypi.org/project/adafruit-ampy-master/) is used\ninstead of [adafruit-ampy](https://pypi.org/project/adafruit-ampy/)\nin order to allow upload progress display, because the official package is not up-to-date with [master](https://github.com/damiencorpataux/ampy).*\n\n\nInstallation\n------------\n\n```s\npip uninstall adafruit-ampy  # see requirements.txt (this is 0.0.1)\npip install --user microdeploy\n```\n```s\nmicrodeploy\nmicrodeploy --help\n```\n\n\nCLI Usage\n---------\n\n```s\nmicrodeploy                          # With default config file: microdeploy.yaml\nmicrodeploy --port /dev/ttyUSB0      # Without config file\nmicrodeploy --config other.yaml      # Use alternate config file\nmicrodeploy --baud 115200 --port XYZ  # Override config\n\nmicrodeploy config\nmicrodeploy config show\n\nmicrodeploy device\nmicrodeploy device show\nmicrodeploy device ls\nmicrodeploy device put main.py\nmicrodeploy device put test.py main.py\nmicrodeploy device rm main.py\nmicrodeploy device mkdir testdir\nmicrodeploy device rmdir testdir\nmicrodeploy device rmdir .  # Note: Remove all files on MCU filesystem.\n\nmicrodeploy device console\n\nmicrodeploy package\nmicrodeploy package names\nmicrodeploy package files tests\nmicrodeploy package push tests\nmicrodeploy package push tests --debug --nofail --noput --norun --force\nmicrodeploy package run tests-run.py\n\nmicrodeploy package cache\nmicrodeploy package cache show\nmicrodeploy package cache refresh\nmicrodeploy package cache clear\n```\n\n\nPython Usage\n------------\n\n```py\nfrom microdeploy import Microdeploy\n\nhelp(Microdeploy)\n```\n\nWithout config file:\n```py\ndeploy = Microdeploy(port='/dev/ttyUSB0')\n\ndeploy.config.show()\ndeploy.device.ls()\ndeploy.device.put('main.py')\ndeploy.device.put('lib.py', '/lib/lib.py')\n\ndeploy.device.run('sandbox/test-something.py')\ndeploy.device.reset()\n```\n\nWith config file (relative to cwd):\n```py\ndeploy = Microdeploy(config='microdeploy.yaml')\n\ndeploy.package.show('tests')\ndeploy.package.files('tests')\ndeploy.package.push('tests')\n```\n\n\nExample\n-------\nAutomation of deploy and run tests on MCU - see code in [`example/project`](example/project).\n\nPush the package (2 times to see the cache working):\n```s\npython3 -m microdeploy -c example/project/microdeploy.yaml package push tests-run\n```\n```s\nDeploying package: tests-run: 4 files -> MCU...\n\nPut: example/project/tests/__init__.py\n  -> tests/__init__.py... 23 bytes\n       0%, 0.0s, 0 bits/s, 23 bytes left, 0.0s left.\n\nCreating directory: tests\n\nPut: example/project/tests/__init__.py\n  -> tests/__init__.py... 23 bytes\n     100%, 0.9s, 209 bits/s, 0 bytes left, 0.0s left.\n\nPut: example/project/tests/test_pin.py\n  -> tests/test_pin.py... 579 bytes\n     100%, 1.3s, 3596 bits/s, 0 bytes left, 0.0s left.\n\nPut: example/project/tests/lib/unittest.py\n  -> tests/lib/unittest.py... 7193 bytes\n       0%, 0.0s, 0 bits/s, 7193 bytes left, 0.0s left.\n\nCreating directory: tests/lib\n\nPut: example/project/tests/lib/unittest.py\n  -> tests/lib/unittest.py... 7193 bytes\n     100%, 5.4s, 10559 bits/s, 0 bytes left, 0.0s left.\n\nPut: example/project/tests-run.py\n  -> tests-run.py... 55 bytes\n     100%, 0.9s, 490 bits/s, 0 bytes left, 0.0s left.\n\nRun: tests-run.py...\n---8<---------\ntest_pin_on (TestPin) ... ok\ntest_pin_off (TestPin) ... ok\ntest_pin_toggle (TestPin) ... ok\nRan 3 tests\n\nOK\n--------->8---\n\nOK: Pushed to MCU 4/4 files from package: tests-run.\nRan on MCU: ['tests-run.py'].\n```\n\nMore on asciinema:\n\n- [Device access](https://asciinema.org/a/v0fogxAifNFMB7WoQG7nCVc6Q)\n\n- [Cache management](https://asciinema.org/a/UTXTudQKR9ewKX0VzJLh7dVHz)\n\n- [Configuration management](https://asciinema.org/a/q2KcZO7ilcrjLbYrB4NlPprFm)\n\n- [Package management](https://asciinema.org/a/oPRYVrOjRq2mXGL6AFCIRKadr)\n\n\nDevelopment\n-----------\n\nThis prototype was written because I was tinkering with ESP in a project with multiple files.\nI was tired of forgetting to upload this or that file, and testing partly outdated code,\n<br>or needing to upload all files again every time. It became worse when I had to test my project on both ESP32 and 8266.\n\nProject facts:\n\n* [Semantic Versioning](https://semver.org/) is followed\n\n* Stage of development: [MVP](https://en.wikipedia.org/wiki/Minimum_viable_product)\n\n* The smaller the better:\n   ```wc -l microdeploy/*```\n   ```s\n    91 microdeploy/cli.py\n   103 microdeploy/config.py\n   293 microdeploy/device.py\n   197 microdeploy/__init__.py\n     6 microdeploy/__main__.py\n    77 microdeploy/package.py\n   767 total\n   ```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Micropython deployment toolchain",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/damiencorpataux/microdeploy"
    },
    "split_keywords": [
        "micropython",
        "deploy",
        "deployment",
        "microcontroller",
        "mcu",
        "serial",
        "ampy",
        "rshell",
        "picocom",
        "console",
        "cache",
        "caching"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2549fef129abb8d450be6b7917188279558da60410eff5eaeb02a4a57318689",
                "md5": "93272f29a3bdaf561e7dcb4f2256c56b",
                "sha256": "6688128d2d67c65cd39cfb905b1407b05c71f81bf99d5f5437dfc75743db69a0"
            },
            "downloads": -1,
            "filename": "microdeploy-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93272f29a3bdaf561e7dcb4f2256c56b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15315,
            "upload_time": "2023-09-14T13:18:09",
            "upload_time_iso_8601": "2023-09-14T13:18:09.948956Z",
            "url": "https://files.pythonhosted.org/packages/c2/54/9fef129abb8d450be6b7917188279558da60410eff5eaeb02a4a57318689/microdeploy-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bb0e9be3a1439c0a88b858b5c70a50678fcbc7ccc2d83217f0f9bb2d47c72ca",
                "md5": "df9e47f4f954b130acf8afe35ccd5c5d",
                "sha256": "3fe4d0ab37909a26ce6e7268ec954b6d7acb1a0a2878fc7895b9a4c0db94c1d8"
            },
            "downloads": -1,
            "filename": "microdeploy-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "df9e47f4f954b130acf8afe35ccd5c5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15165,
            "upload_time": "2023-09-14T13:18:13",
            "upload_time_iso_8601": "2023-09-14T13:18:13.408108Z",
            "url": "https://files.pythonhosted.org/packages/2b/b0/e9be3a1439c0a88b858b5c70a50678fcbc7ccc2d83217f0f9bb2d47c72ca/microdeploy-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-14 13:18:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "damiencorpataux",
    "github_project": "microdeploy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "microdeploy"
}
        
Elapsed time: 0.11504s