mpbridge


Namempbridge JSON
Version 1.4.0 PyPI version JSON
download
home_page
SummaryFile System Bridge to facilitate working with files on Micropython devices
upload_time2023-10-29 13:14:26
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2022 Amirreza Hamzavi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords micropython filemanager file-manager filesystem sync synchronize
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📂 MPBridge ![Python Version](https://img.shields.io/badge/Python-3.7%20or%20later-blue?style=flat-square) ![PyPI Version](https://img.shields.io/pypi/v/mpbridge?label=PyPI%20Version&style=flat-square) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/AmirHmZz/mpbridge/python-publish.yml?label=Builds&style=flat-square)

CLI tool to synchronise and manage files on a [MicroPython](https://github.com/micropython/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

![](flowchart_sync.svg)

![](flowchart_sync_files.svg)

* 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.

#### ⚜️ Development Mode

![](flowchart_dev.svg)

* 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).

#### ⚜️ 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

- Python 3.7 or above.
- [mpremote](https://pypi.org/project/mpremote/) >= 0.4.0
- [watchdog](https://pypi.org/project/watchdog/) >= 2.2.0
- [click](https://pypi.org/project/click/) >= 7.0
- [colorama](https://pypi.org/project/colorama/) >= 4.0

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mpbridge",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "micropython,filemanager,file-manager,filesystem,sync,synchronize",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/75/e0/a3cd26eba3acb52611f68c861ab1c5b98c0891125a09feab00da1d2412aa/mpbridge-1.4.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\udcc2 MPBridge ![Python Version](https://img.shields.io/badge/Python-3.7%20or%20later-blue?style=flat-square) ![PyPI Version](https://img.shields.io/pypi/v/mpbridge?label=PyPI%20Version&style=flat-square) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/AmirHmZz/mpbridge/python-publish.yml?label=Builds&style=flat-square)\n\nCLI tool to synchronise and manage files on a [MicroPython](https://github.com/micropython/micropython)\nrunning device.\n\n## \ud83d\udce5 Installation\n\n`mpbridge` must be installed with `sudo` or `administrator` level of permission in order to be accessible from terminal:\n\n* **Windows :** Open `cmd.exe` or `powershell.exe` as administrator and run `pip install -U mpbridge`.\n* **Linux / MacOS :** Run `sudo pip install -U mpbridge`.\n\n## \ud83d\udd0e How to use\n\nYou can use `mpbridge` in several ways based on your needs:\n\n#### \u269c\ufe0f Bridge Mode\n\n* Run `mpbridge bridge [PORT]`.\n* This mode copies all files and folders from your `MicroPython` board into a temporary directory on your local device\n  and listens for any filesystem events on local directory to apply them on your board. It keeps raw repl open, so you\n  cannot use serial port in other applications simultaneously.\n\n#### \u269c\ufe0f Sync Directory\n\n![](flowchart_sync.svg)\n\n![](flowchart_sync_files.svg)\n\n* Run `mpbridge sync [PORT] [DIR_PARH]`.\n* This command syncs a specified local directory with a `MicroPython` board. The sync process will push\n  all modified files and folders into board and also pull changes from board and exits.\n* If a conflict occurs, `mpbridge` will choose the **local version** of file automatically and\n  overwrites it on connected board.\n\n#### \u269c\ufe0f Development Mode\n\n![](flowchart_dev.svg)\n\n* Run `mpbridge dev [PORT] [DIR_PARH]`.\n* This mode repeats a loop of tasks in specified directory on `MicroPython` device as below:\n    * _Sync_ \u2192 _Prompt to enter REPL_ \u2192 _Clean Sync_ \u2192 _Start MicroPython REPL_\n* You can also disable prompt with `--no-prompt` option to speed things:\n    * _Clean Sync_ \u2192 _Start MicroPython REPL_\n* This mode is useful when you keep switching between different tools to flash and run new codes repeatedly.\n  You can specify your project directory as `DIR_PATH` and `mpbridge` will take care of changes when you are developing\n  your project in your desired IDE. You can switch to `MicroPython REPL` anytime you wish to run the updated code on\n  your board.\n* Default to current path of terminal if not set the `DIR_PATH`.\n* Automatic reset before entering MicroPython REPL can be enabled with `--auto-reset` option which can be set to\n  `soft` (soft reset) or `hard` (hard reset).\n\n#### \u269c\ufe0f Delete all files\n\n* Run `mpbridge clear [PORT]`.\n* This command deletes all files and directories from `MicroPython` board and exits.\n\n#### \u269c\ufe0f List all connected devices\n\n* Run `mpbridge list`.\n* This command lists all connected devices.\n\n**Note** : `[PORT]` can be the **full port path** or one of the **short forms** below :\n\n* `c[n]` for `COM[n]` (`c3` is equal to `COM3`).\n* `u[n]` for `/dev/ttyUSB[n]` (`u3` is equal to `/dev/ttyUSB3`).\n* `a[n]` for `/dev/ttyACM[n]` (`a3` is equal to `/dev/ttyACM3`).\n\n## \ud83d\udc40 Ignore files\n\nYou can inform `mpbridge` to ignore syncing specific files or directories. This is useful when you don't want to sync\nsome directories like `.git/` or `venv/` with your board. To use this feature create a file named `mpbridge.ignore` in\nyour project directory and specify list of files and directories:\n\n```\n.git/\nvenv/\ntests/test_1.py\ntests/test_2.py\n```\n\n* `mpbridge.ignore` syntax is not as same as `.gitignore` files.\n* At this time `mpbridge.ignore` only supports specifying file and directory paths directly.\n* You should add a **slash** at the end of directory names: `dir1/`.\n* Performing `sync` with `--dry-run` flag can be helpful for debugging your ignore files.\n\n## \u2705 Supported platforms\n\n- Windows\n- MacOS\n- Linux\n- FreeBSD/BSD\n\n## \ud83d\udce6 Dependencies\n\n- Python 3.7 or above.\n- [mpremote](https://pypi.org/project/mpremote/) >= 0.4.0\n- [watchdog](https://pypi.org/project/watchdog/) >= 2.2.0\n- [click](https://pypi.org/project/click/) >= 7.0\n- [colorama](https://pypi.org/project/colorama/) >= 4.0\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Amirreza Hamzavi  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "File System Bridge to facilitate working with files on Micropython devices",
    "version": "1.4.0",
    "project_urls": {
        "homepage": "https://github.com/AmirHmZz/mpbridge"
    },
    "split_keywords": [
        "micropython",
        "filemanager",
        "file-manager",
        "filesystem",
        "sync",
        "synchronize"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bce9f09078775f93c319c6e532841261bbbb041c4d88978a7547793bc62e4a3d",
                "md5": "c848e23669b933d56743c3679d28e43f",
                "sha256": "f4516307fce66cdf702eb572b9463fea03e0673bfbef173e2b40c15962b9dd54"
            },
            "downloads": -1,
            "filename": "mpbridge-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c848e23669b933d56743c3679d28e43f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12344,
            "upload_time": "2023-10-29T13:14:23",
            "upload_time_iso_8601": "2023-10-29T13:14:23.672297Z",
            "url": "https://files.pythonhosted.org/packages/bc/e9/f09078775f93c319c6e532841261bbbb041c4d88978a7547793bc62e4a3d/mpbridge-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75e0a3cd26eba3acb52611f68c861ab1c5b98c0891125a09feab00da1d2412aa",
                "md5": "70706c212bcb57ea03de726793762f60",
                "sha256": "c7b70563146597413a70272df0ca691677d842f5229b5e61fed7e98167e37979"
            },
            "downloads": -1,
            "filename": "mpbridge-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "70706c212bcb57ea03de726793762f60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12528,
            "upload_time": "2023-10-29T13:14:26",
            "upload_time_iso_8601": "2023-10-29T13:14:26.404801Z",
            "url": "https://files.pythonhosted.org/packages/75/e0/a3cd26eba3acb52611f68c861ab1c5b98c0891125a09feab00da1d2412aa/mpbridge-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-29 13:14:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AmirHmZz",
    "github_project": "mpbridge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mpbridge"
}
        
Elapsed time: 0.12768s