MicroPython deployment & synchronization tool for Raspberry Pi Pico
Project description
Pico Sync Tool
Pico Sync — a compact CLI tool for working with Raspberry Pi Pico / Pico W running MicroPython. Provides commands for file synchronization, filesystem browsing, basic file operations on the device, serial monitoring, and device reboot.
Works on top of mpremote. Supports interactive mode with menus, fzf, language selection (UA/EN).
Installation
pip install pico_sync
Or from GitHub:
git clone https://github.com/toldk98/pico_sync.git
cd pico_sync
pip install -r requirements.txt
Dependencies
- Python 3.7+
pyserial— serial port communicationmpremote— running commands on Picofzf(optional) — fast search and menus
1. Purpose
The goal is to make MicroPython development feel as close as possible to working with a local project.
Features:
- 🔄 Sync — upload files from
src/to Pico (see Interactive mode or CLI) - 🧠 SHA-sync — only changed files are uploaded (SHA-256)
- 🗑 Auto-removal — files on Pico not present locally are deleted
- 🧼 Empty directory cleanup — after sync
- ⛔
.picoignore— ignore rules (like.gitignore) - 📂 Interactive file browser — view, read, edit, delete on Pico
- 🔍 Auto-detect port — search for Pico among serial ports
- 🔌 Serial monitor — live log output from Pico
- 🔁 Reboot — software reset
- 🌐 Language — Ukrainian / English
- 📦 Project management — save projects with settings
The tool is ~246 KB, split into modules for maintainability and testing. Unneeded modules can be removed if desired.
2. Usage
The tool can be run in different modes:
# Interactive mode (menus, browser, sync) — [section 6](#6-interactive-mode)
picosync
# CLI mode (one-shot commands) — [section 7](#7-cli-reference-and-examples)
picosync --sync
picosync --ls /main.py
picosync --monitor
# As a Python module
python -m pico_sync
3. Project structure
project_root/
│
├── .picoignore # ignore rules
├── .picosyncconfig # project config (port, filter)
├── meta/ # metadata (updates, etc.)
│
└── src/ # files synced to Pico
⚠️ Important:
.picoignoreonly affects files insidesrc/- Only
src/is synced — files outside never reach Pico
4. The .picoignore file
Ignore rules follow a syntax similar to .gitignore.
Examples:
# Ignore caches
__pycache__/
*.pyc
# Recursively ignore all .log files
**/*.log
# Specific file
config/local_settings.py
# Directory
tests/
Supported patterns:
| Pattern | Description |
|---|---|
* |
Any characters within a directory |
** |
Recursive multi-level match |
? |
Single character |
dir/ |
Entire directory |
*.ext |
File mask |
5. Technical details
SHA-sync
- Each local file gets its SHA-256 calculated
- Pico computes SHA-256 of all remote files via a single mpremote exec
- If hashes match → file is skipped
- If hashes differ or file is missing → file is uploaded
- Files on Pico not present locally are deleted
- Empty directories are removed
Port
Port detection order:
- If
piconameis configured in.picosyncconfig— find Pico whose/.piconamematches - Value from
.picosyncconfigportfield (if set) - Auto-detect: scan serial devices by USB VID. If multiple Picos found — the first one is used
- If nothing found — a message about missing port is shown
The port is stored in os.environ["MPREMOTE_PORT"].
.piconame
/.piconame is an optional text file identifier on the Pico itself.
It can be created manually or via picosync --set-name my-device. When piconame is set in the project config, pico_sync will find the exact Pico with the matching name, even when multiple devices are connected.
BAUD = 115200
Standard MicroPython serial speed on RP2040.
Used in monitor mode (--monitor).
6. Interactive mode
Without arguments (or with --pick) the interactive mode starts.
On first launch you will see a list of saved projects. If no projects exist yet — a prompt to add the current directory. After selecting a project (or adding a new one), you enter the project's main menu.
Main menu
.. — back to project list
[i] info — project info (read-only)
[f] files — Pico file browser
[d] device — sync, monitor, reboot
[c] config — port, src, update settings, init
File browser
Browse the Pico file tree. Actions per file:
cat— print contentsedit— edit in system editorrm— delete[r] refresh— refresh file list[*] find— search all files
Device
sync— sync with filter selectionmonitor— serial monitorreboot— reboot Pico
Config
port_settings— Pico connection settings: manual port selection or auto-find by device namecheck_update— check for updatesinit— create.picoignore,meta/,.picosyncconfig
Language
[~] lang in the project list switches language.
Sync filters
| Filter | Description |
|---|---|
all |
All files (removes extras on Pico) |
py |
Only .py |
py+ |
.py, .txt, .json |
nopy |
Everything except .py |
.ext,.ext2 |
Custom comma-separated extensions |
Example session
$ picosync
[1] my-project (/home/user/projects/my-project)
[+] add project
[~] lang
> 1 # select project
.. — back to project list
[i] info — project information
[f] files — Pico file browser
[d] device — sync, monitor, reboot
[c] config — settings
> d # device menu
sync
monitor
reboot
> sync # sync files
filter (all):
Files: 12, synced: 3, skipped: 9
7. CLI reference and examples
Help
picosync --help
usage: picosync [-h] [--port PORT] [--src SRC] [--sync] [--ls PATH]
[--cat FILE] [--edit FILE] [--search_port] [--check_update]
[--reboot] [--monitor] [--pick] [--filter FILTER] [--init]
[--lang {ua,en}] [--version]
{project} ...
Pico Sync Tool — sync/ls/cat/edit for Raspberry Pi Pico
options:
-h, --help Show help
--port PORT Pico COM port (auto-detect if not set)
--src SRC Sync directory (default: src)
--sync Sync src → Pico
--ls PATH List files in a Pico directory
--cat FILE Print file contents
--edit FILE Edit a remote file
--search_port Interactive serial port search
--check_update Check for updates
--reboot Reboot Pico
--monitor Serial monitor
--pick Interactive mode
--filter FILTER Sync filter (default: all)
--init Create .picoignore and meta/
--set-name NAME Write /.piconame to Pico and save to config
--lang {ua,en} Interface language
--version Version
Sync
picosync --sync # all files
picosync --sync --filter py # .py only
picosync --sync --filter .wav,.mpy # custom extensions
picosync --src my_src --sync # custom src
File listing
picosync --ls /
picosync --ls /spm
picosync --cat /main.py
Editing
picosync --edit /config/settings.py
The file is downloaded to a temp file, opened in an editor, and uploaded back on save.
Port search
picosync --search_port
Monitor
picosync --monitor
Auto-reconnects on:
- Pico reboot
- USB port change
- temporary disconnection
Reboot
picosync --reboot
Software reset via mpremote reset — equivalent to pressing RUN.
Version
picosync --version
8. Project system
Projects are stored in ~/.config/pico_sync/projects.json.
Each project stores its path, port setting, sync filter, and last used src.
Managing projects
picosync project list # list projects
picosync project add /path # add an existing directory
picosync project remove name # remove project from list
In interactive mode, projects are shown on the start screen.
[+] add project adds the current directory, [~] lang switches language.
9. User guide
✔ Step 1. Install
pip install pico_sync
✔ Step 2. Prepare project
project/
├── .picoignore
└── src/
└── main.py
✔ Step 3. Connect Pico via USB
✔ Step 4. Run
picosync
The project list will appear. If no projects exist yet — a prompt to add the current directory. Select a project or add a new one — you enter the main menu.
✔ Step 5. Configure port (optional)
Pico_sync automatically detects Pico among serial ports. If only one device is connected — no configuration needed.
If auto-detect fails or multiple Picos are connected — [c] config → port for manual selection.
✔ Step 6. Sync
[d] device → sync — select a filter and sync.
✔ Step 7. Work with files
[f] files — browse, edit, delete.
10. FAQ
Pico not found / port not detected
Make sure Pico is connected via USB data cable (power-only cables won't work). If auto-detect fails — use picosync --search_port for manual selection.
Two Picos connected at once
Auto-detect picks the first one found. To work with a specific device — configure .piconame via picosync --set-name <name> or [c] config → piconame → set.
Files not syncing / not all files on Pico
Check .picoignore — the file might match an ignore rule. By default the src/ directory is synced.
Error "No module named 'pyserial' / 'mpremote'"
Install dependencies: pip install pyserial mpremote
How to update Pico Sync?
pip install --upgrade pico_sync
Or [c] config → check_update in interactive mode.
License
AGPL-3.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pico_sync-1.1.1.tar.gz.
File metadata
- Download URL: pico_sync-1.1.1.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69b8211c1cb552c62e237584718d15c29233dca52b3f5f1458dfd7963ffac0e6
|
|
| MD5 |
ef9e42dd5c589bb5c5b91c6456037f10
|
|
| BLAKE2b-256 |
ce83610852554e6a665fa51cc5ae01c757edf295bf7e7df42c0a120658dc06ca
|
File details
Details for the file pico_sync-1.1.1-py3-none-any.whl.
File metadata
- Download URL: pico_sync-1.1.1-py3-none-any.whl
- Upload date:
- Size: 43.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0b52c1c15183180e4cad21fd50e7603284a40f034e988b8029fa36f28ca982e
|
|
| MD5 |
6b5230252815ab2610f448520bf5e6f5
|
|
| BLAKE2b-256 |
7626ddf67105e6447ffc7f68d0e8bd3284675b6a456dacac58a7ce173d5ec541
|