https://github.com/keredson/mpysync
https://github.com/keredson/mpysync
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/keredson/mpysync
- Owner: keredson
- License: gpl-3.0
- Created: 2022-03-10T00:41:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-10T21:34:11.000Z (over 4 years ago)
- Last Synced: 2025-11-27T18:46:18.297Z (7 months ago)
- Language: Python
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpysync
Rsync-like tool for [MicroPython](https://micropython.org/).
- Works over serial or WiFi.
- Can be run (as an async task) in the background of your normal app (for remote updates).
- Generally 10-100x faster than using [Adafruit's Ampy](https://pypi.org/project/adafruit-ampy/).
## Install
```
$ pip install mpysync
```
## Performance
Take for example, a decently sized project (50 files, 836K) on an ESP32...
Copying all files with `ampy`:
```
$ time ampy --port /dev/ttyUSB0 put build/ui ui
real 8m33.000s
```
Vs. rsync-ing the same files (no changes):
```
$ time python -m mpysync build/ --host 10.0.0.179
real 0m1.511s
$ time python -m mpysync build/ --port /dev/ttyUSB0
real 0m6.858s
```
Worst case (no files in common), copying all files w/ `mpysync` is still an order of magnitude faster:
```
$ time python -m mpysync build/ --port /dev/ttyUSB0
real 0m59.650s
```
## CLI Usage
### Over Serial
```
python -m mpysync build/ --port /dev/ttyUSB0
```
### Over WiFi
```
python -m mpysync build/ --host 10.0.0.179
```
### All Options
```
python -m mpysync [--directory ] [--host ] [--port ] [--baud ] [--dry_run ] [--clear_cache ] [--verify ]
```
## OTA Usage
In your `main.py` or (or anywhere really):
```
import mpysync.server
```
Then (somewhere later in your code), start the main event loop:
```
import uasyncio as asyncio
asyncio.get_event_loop().run_forever()
```
By default it listens on port 31261.
### Memory
When running in the background (for OTA updates), `mpysync` consumes 16k RAM if you're already using uttp, 20k otherwise.