MPY tool - manage files on devices running MicroPython

Related tags

Hardwarempytool
Overview

mpytool

MPY tool - manage files on devices running MicroPython

It is an alternative to ampy

Target of this project is to make more clean code, faster, better verbose output...

Installation

pip3 install mpytool

Examples:

help:

$ mpytool --help

list files:

$ mpytool -p /dev/ttyACM0 ls
$ mpytool -p /dev/ttyACM0 ls lib

tree files:

$ mpytool -p /dev/ttyACM0 tree

upload file or whole directory:

$ mpytool -p /dev/ttyACM0 put boot.py
$ mpytool -vp /dev/ttyACM0 put app/lib
$ mpytool -vp /dev/ttyACM0 --exclude-dir build --exclude-dir dist put app/src light_control

view content of file or download:

$ mpytool -p /dev/ttyACM0 get boot.py
$ mpytool -p /dev/ttyACM0 get net.py >> net.py

make directory, erase dir or files:

$ mpytool -p /dev/ttyACM0 mkdir a/b/c/d xyz/abc
$ mpytool -p /dev/ttyACM0 delete a xyz

restart only, restart and follow output:

$ mpytool -p /dev/ttyACM0 restart
$ mpytool -p /dev/ttyACM0 restart follow

Examples using API from Python

>> mpy.delete('a/b')">
>>> import mpytool
>>> conn = mpytool.ConnSerial(port='/dev/ttyACM0', baudrate=115200)
>>> mpy = mpytool.Mpy(conn)
>>> mpy.ls()
[('ehome', None), ('boot.py', 215), ('net.py', 2938), ('project.json', 6404)]
>>> mpy.mkdir('a/b/c')
>>> mpy.ls()
[('a', None),
 ('ehome', None),
 ('boot.py', 215),
 ('net.py', 2938),
 ('project.json', 6404)]
>>> mpy.get('boot.py')
b"import time\nimport net\n\nwlan = net.Wlan()\nwlan.refresh_network()\n\nwhile wlan.ifconfig()[0] == '0.0.0.0':\n    time.sleep(.1)\n\nprint('IP: ' + wlan.ifconfig()[0])\n\nimport ehome.ehome\n\nehome.ehome.start('project.json')\n"
>>> mpy.delete('a/b')

Verbose and debug output

use -v or -vv to show verbose output (like currently processing file, ..)

  • normally print only errors (red)
  • -d print warnings (yellow)
  • -dd print info messages (purple)
  • -ddd print debug messages (blue)

for reporting bugs, please provide in to issue also -ddd messages

MPYTOOL vs AMPY

for test used: ESP32S2 over USB 2MB RAM and 2MB FLASH: recursive put of 30 files in 4 folders, 70KB total:

  • mpytool: 12.3s
  • ampy: 79.3s

Requirements

Working only with MicroPython boards, not with CircuitPython

  • python v3.6+
  • pyserial v3.0+

Running on:

  • Linux
  • MacOS
  • Windows

Credits

(c) 2022 by Pavel Revak

Support

  • Basic support is free over GitHub issues.
  • Professional support is available over email: Pavel Revak.
Owner
Pavel Revak
Embedded, Microcontrollers, Electronics, Linux, C++, Python
Pavel Revak
Custom component for interacting with Octopus Energy

Home Assistant Octopus Energy ** WARNING: This component is currently a work in progress ** Custom component built from the ground up to bring your Oc

David Kendall 116 Jan 02, 2023
a weather application for the raspberry pi and the Pimorioni Inky pHAT.

raspi-weather a weather application for the raspberry pi and the Inky pHAT

Derek Caelin 59 Oct 24, 2022
This allows you to record keyboard and mouse input, and play it back using pynput.

Record and Play with Python! This allows you to record keyboard and mouse input, and play it back (with looping) using pynput. It allows for automatio

George Jensen 45 Jan 02, 2023
This Home Assistant custom component adding support for controlling Midea dehumidifiers on local network.

This custom component for Home Assistant adds support for Midea air conditioner and dehumidifier appliances via the local area network. homeassistant-

Nenad Bogojevic 92 Dec 31, 2022
Iec62056-21-mqtt - Publish DSMR P1 telegrams acquired over IEC62056-21 to MQTT

IEC 62056-21 Publish DSMR P1 telegrams acquired over IEC62056-21 to MQTT. -21 is

Marijn Suijten 1 Jun 05, 2022
Home-Assistant MQTT bridge for Panasonic Comfort Cloud

Panasonic Comfort Cloud MQTT Bridge Home-Assistant MQTT bridge for Panasonic Comfort Cloud. Note: Currently this brige is a one evening prototype proj

Santtu J盲rvi 2 Jan 04, 2023
Code for the paper "Planning with Diffusion for Flexible Behavior Synthesis"

Planning with Diffusion Training and visualizing of diffusion models from Planning with Diffusion for Flexible Behavior Synthesis. Guided sampling cod

Michael Janner 310 Jan 07, 2023
BoneIO is a compact IO controller for home automation.

Project description BoneIO is a compact IO controller for home automation. Main features of this controller are Compact size (27x11x6)cm - 15 DIN modu

Maciej Krasuski 120 Nov 30, 2022
DNP3 Stalker is a project to analyze and interact with DNP3 devices

DNP3 Stalker Purpose DNP3 Stalker is a project to analyze and interact with DNP3

Cutaway Security, LLC. 2 Feb 10, 2022
GUI wrapper designed for convenient service work with TI CC1352/CC2538/CC2652 based Zigbee sticks or gateways. Packed into single executable file

ZigStar GW Multi tool is GUI wrapper firtsly designed for convenient service work with Zig Star LAN GW, but now supports any TI CC1352/CC2538/CC2652 b

133 Jan 01, 2023
A global contest to grow and monitor your own food with Raspberry Pi

growlab A global contest to grow and monitor your own food with Raspberry Pi A capture from phototimer of my seed tray with a wide-angle camera positi

Alex Ellis 442 Dec 23, 2022
Home Assistant custom integration for e-distribuci贸n

e-Distribuci贸n is an energy distribution company that covers most of South Spain area. If you live in this area, you probably are able to register into their website to get some information about you

VMG 17 Sep 07, 2022
馃惐馃枿Cat printer is a portable thermal printer sold on AliExpress for around $20.

Cat printer is a portable thermal printer sold on AliExpress for around $20. This repository contains Python code for talking to the cat printer over

671 Jan 05, 2023
A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost.

distance sensor cube timer A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost. How to

3 Feb 21, 2022
A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

J茅r么me W. 75 Jan 07, 2023
Smart Tech Automation Remote via Kinematics Gesture control for IoT devices

STARK Smart Tech Automation Remote via Kinematics Gesture control for IoT devices View Demo 路 Report Bug 路 Request Feature Table of Contents About The

Juseong (Joe) Kim 1 Jan 29, 2022
ESP32 recording button presses, and serving webpage that graphs the numbers over time.

ESP32-IoT-button-graph-test ESP32 recording button presses, and serving webpage via webSockets in order to graph the responses. The objective was to t

f-caro 1 Nov 30, 2021
Python library for the Phomemo m02s bluetooth thermal printer

Phomemo M02S Python library This is a basic Python library for controlling the Phomemo M02S bluetooth thermal printer. It probably only works on Mac &

Stargirl Flowers 28 Nov 07, 2022
This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

Stanford Student Robotics 1.2k Dec 25, 2022
Toy robot that traverses on a finite surface

Toy Robot Challenge - Release Notes November 12, 2021 New features Initialisation - Users can set the home position and heading of the robot. Position

Ze Fei Teo 0 Feb 03, 2022