Close
0%
0%

MPYtool - Fast File Manager for MicroPython Device

A fast, feature-rich alternative to mpremote for managing MicroPython devices via serial or network.

vlkvlk
Similar projects worth following
0 followers
MPYtool is a fast CLI tool for managing files on MicroPython devices. It's an alternative to the official mpremote with better performance and developer experience.

Performance: 3-5x faster uploads than mpremote. Skips unchanged files using SHA256 hash. Auto-compression and chunk size tuning.

Mount VFS: Mount local directory on device without uploading to flash. Read-write support, transparent .mpy compilation, auto-remount after soft reset.

Developer-Friendly: Auto-detect serial port, tab completion with remote paths, chain commands with --, clean progress output.

Flash Operations: RP2 flash backup/restore, ESP32 partition management and OTA updates.

Cross-Platform: Linux, macOS, Windows. Serial and TCP connections.

https://github.com/pavelrevak/mpytool

Key Features

Performance

  • 3-5x faster uploads than mpremote for large files
  • Skip unchanged files - compares size + SHA256 hash, re-upload check in <1s
  • Automatic compression with deflate (when available)
  • Auto-tuned chunk sizes based on device RAM
  • Python API - suitable for IDE integration and automation

Mount VFS

  • Mount local directory on device without uploading to flash
  • Read-write support for rapid prototyping
  • Transparent .mpy compilation on-the-fly
  • Auto-remount after soft reset with CWD preservation
  • Virtual submounts (ln) to compose filesystem from multiple directories

Developer-Friendly

  • Auto-detect serial port (no -p needed with single device)
  • Tab completion for ZSH and Bash with remote path completion
  • Chain multiple commands with -- separator
  • Clean progress output with skip/transfer statistics

General-Purpose Terminal

  • repl and monitor work with any serial device
  • Multiple reset modes: soft, MCU, hardware (RTS), bootloader
  • Works with USB-CDC and USB-UART bridges (CP2102, CH340)

Flash Operations

  • RP2: Read/write/erase user flash
  • ESP32: Partition management, OTA firmware updates

Cross-Platform

  • Linux, macOS, Windows
  • Network support (TCP connections)
  • Python 3.10+

  • 1
    examples

    Installation

    $ pip install mpytool

     Help

    $ mpytool --help
    usage: mpytool [-h] [-V] [-p PORT] [-a ADDRESS] [-b BAUD] [-d] [-v] [-q] [-e EXCLUDE] [-f] [-z] [-Z] [-c SIZE] ...
    
    MPY tool - manage files on devices running MicroPython
    
    positional arguments:
      commands              commands
    
    options:
      -h, --help            show this help message and exit
      -V, --version         show program version number and exit
      -p, --port PORT       serial port
      -a, --address ADDRESS
                            network address
      -b, --baud BAUD       baud rate
      -d, --debug           debug level
      -v, --verbose         verbose output
      -q, --quiet           quiet mode
      -e, --exclude EXCLUDE
                            exclude pattern (wildcards: *, ?)
      -f, --force           force overwrite
      -z, --compress        force compression
      -Z, --no-compress     disable compression
      -c, --chunk-size SIZE
                            chunk size (512, 1K-32K, auto)
    
    Commands (use ' --help' for details):
      ls           List files and directories on device.
      tree         Show directory tree on device.
      cat          Print file content from device to stdout.
      cp           Copy files between local and device.
      mv           Move or rename files on device.
      mkdir        Create directory (with parents if needed).
      rm           Delete files/dirs. Use :path/ for contents only.
      pwd          Print current working directory on device.
      cd           Change current working directory on device.
      path         Manage sys.path. Without args, show current path.
      stop         Stop running program on device (send Ctrl-C).
      reset        Reset the device. Default: soft reset (Ctrl-D).
      monitor      Monitor device output. Press Ctrl-C to stop.
      repl         Interactive REPL session. Press Ctrl-] to exit.
      exec         Execute Python code on device.
      run          Run local Python file on device.
      edit         Edit file on device in local editor.
      info         Show device info (platform, memory, filesystem).
      rtc          Get or set device RTC.
      flash        Flash/partition ops (read/write/erase/ota).
      mount        Mount local dir as VFS. Without args, list mounts.
      ln           Link local file/directory into mounted VFS.
      speedtest    Test serial link speed.
      sleep        Pause for specified number of seconds.
    
    Use -- to chain commands:
      mpytool cp main.py : -- reset -- monitor

     List files

    $ mpytool tree
       142 KB ./
      41.3 KB ├─ html/
        587 B │  ├─ index.html
      40.8 KB │  └─ wlan.html
      97.7 KB ├─ lib/
      69.6 KB │  ├─ uhttp/
         93 B │  │  ├─ __init__.py
      26.3 KB │  │  ├─ client.py
      43.2 KB │  │  └─ server.py
      23.2 KB │  ├─ wlan.py
      4.95 KB │  └─ wlan_http.py
         23 B ├─ boot.py
      3.03 KB └─ main.py

     Copy

    $ mpytool cp main.py :/             # upload file to device root
    $ mpytool cp main.py lib.py :/lib/  # upload multiple files to directory
    $ mpytool cp myapp :/               # upload directory (creates :/myapp/)
    $ mpytool cp myapp :/lib/           # upload directory into :/lib/ (creates :/lib/myapp/)
    $ mpytool cp myapp/ :/lib/          # upload directory contents into :/lib/
    $ mpytool cp :/main.py ./           # download file to current directory
    $ mpytool cp :/ ./backup/           # download entire device to backup/
    $ mpytool cp :/old.py :/new.py      # copy file on device
    $ mpytool cp -f main.py :/          # force upload even if unchanged
    $ mpytool cp -m myapp :/            # compile .py to .mpy via mpy-cross

    more examples: https://github.com/pavelrevak/mpytool?tab=readme-ov-file#examples

View all instructions

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates