Skip to main content

📂 MPBridge Python Version PyPI Version GitHub Workflow Status

CLI tool to synchronise and manage files on a MicroPython running device.

📥 Installation

mpbridge must be installed with sudo or administrator level of permission in order to be accessible from terminal:

  • Windows : Open cmd.exe or powershell.exe as administrator and run pip install -U mpbridge.
  • Linux / MacOS : Run sudo pip install -U mpbridge.

🔎 How to use

You can use mpbridge in several ways based on your needs:

⚜️ Bridge Mode

  • Run mpbridge bridge [PORT].
  • This mode copies all files and folders from your MicroPython board 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.

⚜️ Sync Directory

  • Run mpbridge sync [PORT] [DIR_PARH].
  • This command syncs a specified local directory with a MicroPython board. The sync process will push all modified files and folders into board and also pull changes from board and exits.
  • If a conflict occurs, mpbridge will choose the local version of file automatically and overwrites it on connected board.
  • You can speed up syncing with --use-hashtable which allows mpbridge to cache calculated hashes on remote device. By using hashtable you won't be able to track files which are modified by remote device because hash is calculated at uploading stage.

⚜️ Development Mode

  • Run mpbridge dev [PORT] [DIR_PARH].
  • This mode repeats a loop of tasks in specified directory on MicroPython device as below:
    • Sync → Prompt to enter REPL → Clean Sync → Start MicroPython REPL
  • You can also disable prompt with --no-prompt option 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_PATH and mpbridge will take care of changes when you are developing your project in your desired IDE. You can switch to MicroPython REPL anytime you wish to run the updated code on your board.
  • Default to current path of terminal if not set the DIR_PATH.
  • Automatic reset before entering MicroPython REPL can be enabled with --auto-reset option which can be set to soft (soft reset) or hard (hard reset).
  • You can also boost sync speed with --use-hashtable But you won't be able to track files which are modified by remote device itself. Use this option if only host is modifying files.
  • In order to compile source files before uploading to remote device, you should set mpy-cross executable path using --mpy-cross-path flag. Visit Micropython repository to build mpy-cross compiler for your platform.

⚜️ Delete all files

  • Run mpbridge clear [PORT].
  • This command deletes all files and directories from MicroPython board and exits.

⚜️ List all connected devices

  • 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] for COM[n] (c3 is equal to COM3).
  • u[n] for /dev/ttyUSB[n] (u3 is equal to /dev/ttyUSB3).
  • a[n] for /dev/ttyACM[n] (a3 is equal to /dev/ttyACM3).

👀 Ignore files

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.ignore syntax is not as same as .gitignore files.
  • At this time mpbridge.ignore only supports specifying file and directory paths directly.
  • You should add a slash at the end of directory names: dir1/.
  • Performing sync with --dry-run flag can be helpful for debugging your ignore files.

✅ Supported platforms

  • Windows
  • MacOS
  • Linux
  • FreeBSD/BSD

📦 Dependencies

Metadata

Release files for mpbridge 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpbridge 1.6.1
File Size Uploaded
mpbridge-1.6.1.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mpbridge 1.6.1
File Interpreter ABI Platform
mpbridge-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.9 kB

Release files / mpbridge-1.6.1.tar.gz

Download URL mpbridge-1.6.1.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0fee3827eae790fa02b57a0fa7949748172e1ed35b00cbc82d1fb17fb6853f75
BLAKE2b-256 checksum
How to use checksums
e0eacdab3abbec6569ee05779775e8aa52b243bf1b849f79d76094666a50aa0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / mpbridge-1.6.1-py3-none-any.whl

Download URL mpbridge-1.6.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf3bdfd1988a201430b7326c446b7cdfc16075084b3451cbe6c87d914618d2af
BLAKE2b-256 checksum
How to use checksums
0d9efb172bf4d89f63df0b759c6ff2ed2d01846b1d5c0fc12fe0aeae3e1a67e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.6

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page