Skip to main content

Communicate and transfer files from and to MicroyPython boards via REPL

Project description

docs: https://mpy-repl-tool.readthedocs.io/en/latest

Transfer files via Python REPL (Read Evaluate Print Loop). This tool was developed to transfer files from and to MicroPython boards.

This is yet an other tool, there are now several similar tools but not all have the same features.

Key features of this one:

  • detect serial ports and MicroPython boards.

  • run temporary scripts.

  • pull get files and directories from the target filesystem.

  • push files and directories on the target filesystem.

  • mount target as filesystem (FUSE).

  • --interactive mode (terminal).

  • set RTC

  • All of the above, and more, via the serial REPL connection to a MicroPython board.

Usage

Here is the output of python3 -m there --help:

usage: __main__.py [-h] [-p PORT] [-b BAUDRATE] [--set-rtc]
                  [--reset-on-connect] [-c COMMAND] [-i] [--reset] [-u USER]
                  [-w PASSWORD] [-v] [--develop] [--timeit]
                  ACTION ...

Do stuff via the MicroPython REPL

optional arguments:
  -h, --help            show this help message and exit

port settings:
  -p PORT, --port PORT  set the serial port
  -b BAUDRATE, --baudrate BAUDRATE
                        set the baud rate

operations before running action:
  --set-rtc             set the RTC to "now" before command is executed
  --reset-on-connect    do a soft reset as first operation (main.py will not
                        be executed)

operations after running action:
  -c COMMAND, --command COMMAND
                        execute given code on target
  --command-timeout T   timeout in seconds for --command
  -i, --interactive     drop to interactive shell at the end
  --reset               do a soft reset on the end

login:
  -u USER, --user USER  response to login prompt
  -w PASSWORD, --password PASSWORD
                        response to password prompt

diagnostics:
  -v, --verbose         show diagnostic messages, repeat for more
  --develop             show tracebacks on errors (development of this tool)
  --timeit              measure command run time

subcommands:
  use "__main__.py ACTION --help" for more on each sub-command

  ACTION                sub-command help
    detect              help locating a board
    run                 execute file contents on target
    ls                  list files
    hash                hash files
    cat                 print contents of one file
    pull                file(s) to copy from target
    push                file(s) to copy onto target
    rm                  remove files from target
    df                  Show filesystem information
    mount               Make target files accessible via FUSE
    rtc                 Read the real time clock (RTC)

The -c option executes the given string after running all the actions. The -i option enters a miniterm session at the end of all other actions.

The tool automatically selects a USB port for communication, it may take the wrong one if multiple USB serial devices are connected. In that case, use there detect to list all devices and then -p PORT to specify the port to use on the other calls.

Use python3 -m there <action> --help to get help on sub-commands.

Requirements

This tool requires Python 3.

It depends on pySerial for communication and the mount function requires fusepy. Those dependencies are automatically installed when using pip, see installation notes in documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpy-repl-tool-0.12.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

mpy_repl_tool-0.12-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file mpy-repl-tool-0.12.tar.gz.

File metadata

  • Download URL: mpy-repl-tool-0.12.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mpy-repl-tool-0.12.tar.gz
Algorithm Hash digest
SHA256 3dd98ba0b4f27c3f5d913aae9215c58cd6b5a1ac9f6e6cccc1b7d10c2355d227
MD5 6000e36e66c63d352b86f447221393a4
BLAKE2b-256 36a35799b2d57449b3247afb464ec9720ecfdbf1ecec763d6e31f430811e5456

See more details on using hashes here.

File details

Details for the file mpy_repl_tool-0.12-py3-none-any.whl.

File metadata

  • Download URL: mpy_repl_tool-0.12-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mpy_repl_tool-0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 4e82d3e74acb2bee4344a68289c38e59a7939dd064362d3ce4eadb26bc6ecfb5
MD5 74fc899393ba3fd704d0a5f6d1588769
BLAKE2b-256 69e9d4deb0da3352b61db1b2810d12c6cdd00a99f21d07a3814ecd6125fae444

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page