CLI tool to synchronise and manage files on a MicroPython running device.
mpbridge must be installed with sudo or administrator level of permission in order to be accessible from terminal:
- Windows : Open
cmd.exeas administrator and runpip install -U mpbridge - Linux / MacOS : Run
sudo pip install -U mpbridge
You can use mpbridge in several ways based on your needs:
- Run
mpbridge bridge <PORT> - This mode copies all files and folders from your
MicroPythonboard into a temporary directory on your local device and listens for any filesystem events on local directory to apply them on your board. It keeps raw repl open, so you cannot use serial port in other applications simultaneously.
- Run
mpbridge sync <PORT> <DIR_PARH> - This command syncs a specified local directory with a
MicroPythonboard. The sync process will push all modified files and folders into board and also pull changes from board and exits. - If a conflict occurs,
mpbridgewill choose the local version of file automatically and overwrites it on connected board.
- Run
mpbridge dev <PORT> <DIR_PARH> - This mode repeats a loop of tasks in specified directory on
MicroPythondevice as below:- Sync → Prompt to enter REPL → Clean Sync → Start MicroPython REPL
- You can also disable prompt with
--no-promptoption to speed things:- Clean Sync → Start MicroPython REPL
- This mode is useful when you keep switching between different tools to flash and run new codes repeatedly.
You can specify your project directory as
DIR_PATHandmpbridgewill take care of changes when you are developing your project in your desired IDE. You can switch toMicroPython REPLanytime you wish to run the updated code on your board. - Automatic reset before entering MicroPython REPL can be enabled with
--auto-resetoption which can be set tosoft(soft reset) orhard(hard reset).
- Run
mpbridge clear <PORT> - This command deletes all files and directories from
MicroPythonboard and exits.
- Run
mpbridge list - This command lists all connected devices.
Note : <PORT> can be the full port path or one of the short forms below :
c[n]forCOM[n](c3is equal toCOM3)u[n]for/dev/ttyUSB[n](u3is equal to/dev/ttyUSB3)a[n]for/dev/ttyACM[n](a3is equal to/dev/ttyACM3)
You can inform mpbridge to ignore syncing specific files or directories. This is useful when you don't want to sync
some directories like .git/ or venv/ with your board. To use this feature create a file named mpbridge.ignore in
your project directory and specify list of files and directories:
.git/
venv/
tests/test_1.py
tests/test_2.py
mpbridge.ignoresyntax is not as same as.gitignorefiles.- At this time
mpbridge.ignoreonly supports specifying file and directory paths directly. - You should add a slash at the end of directory names:
dir1/
- Windows
- MacOS
- Linux
- FreeBSD/BSD