11# ` mpremote_path ` - a pathlib interface for files on micropython boards
22
3+ [ ![ PyPI] (
4+ https://img.shields.io/pypi/v/mpremote-path )] (
5+ https://pypi.org/project/mpremote-path )
6+ [ ![ PyPI Supported Python Versions] (
7+ https://img.shields.io/pypi/pyversions/mpremote-path.svg )] (
8+ https://pypi.python.org/pypi/mpremote-path/ )
9+ [ ![ GitHub Actions (Tests)] (
10+ https://github.com/glenn20/mpremote-path/actions/workflows/ci-tests.yaml/badge.svg )] (
11+ https://github.com/glenn20/mpremote-path/actions/workflows/ci-tests.yaml )
12+ [ ![ GitHub Actions (Publish)] (
13+ https://github.com/glenn20/mpremote-path/actions/workflows/ci-release.yaml/badge.svg )] (
14+ https://github.com/glenn20/mpremote-path/actions/workflows/ci-release.yaml )
15+ [ ![ PyPI - License] (
16+ https://img.shields.io/pypi/l/mpremote-path )] (
17+ https://opensource.org/licenses/MIT )
18+
319Provides a convenient,
420[ ` pathlib ` ] ( https://docs.python.org/3/library/pathlib.html ) compatible python
521interface to access and manipulate files on a serial-attached
@@ -13,15 +29,25 @@ Version 0.1.2 passes all tests on windows and linux for python versions 3.8,
1329
1430** Contents:**
1531
16- ** [ ` mpremote_path ` ] ( #features ) module: [ Features] ( #features ) | [ Installation] ( #installation ) | [ API Docs] ( #api-docs-mpremote_path-module ) **
32+ ** [ ` mpremote_path ` ] ( #features ) module:
33+ [ Features] ( #features ) |
34+ [ Installation] ( #installation ) |
35+ [ API Docs] ( #api-docs-mpremote_path-module ) **
36+
37+ - A module providing ` pathlib ` -like access to files on a serial-attached
38+ micropython board from a host computer.
1739
1840** [ ` mpremote_path.util.mpfs ` ] ( #mpremote_pathutilmpfs-module ) module:
19- [ Features] ( #mpfs-features ) | [ API Docs -
20- Functions] ( #mpremote_pathutilmpfs-functions ) **
41+ [ Features] ( #mpfs-features ) |
42+ [ API Docs - Functions] ( #mpremote_pathutilmpfs-functions ) **
43+
44+ - Provides convenience methods for working with files using the ` mpremotepath `
45+ module. Includes the ` mpfs ` command line utility for managing files on a
46+ serial-attached micropython board.
2147
2248** [ ` mpremote_path.util.mpfsops ` ] ( #mpremote_pathutilmpfsops-module ) module:
23- [ Features] ( #mpfsops-features ) | [ API Docs -
24- Functions] ( #mpremote_pathutilmpfsops-functions ) **
49+ [ Features] ( #mpfsops-features ) |
50+ [ API Docs - Functions] ( #mpremote_pathutilmpfsops-functions ) **
2551
2652## Features
2753
@@ -71,10 +97,10 @@ def rcopy(src: Path, dst: Path) -> None:
7197
7298MPath.connect(" u0" ) # Use device attached to /dev/ttyUSB0
7399
74- # Make a local copy of a directory
100+ # Make a local copy of a directory on the host computer
75101rcopy(Path(" app" ), Path(" ../app-backup" ))
76102
77- # Copy local directory to the micropython board
103+ # Copy local directory from computer to serial-attached micropython board
78104rcopy(Path(" app" ), MPath(" /lib/app" ))
79105
80106# Copy a directory from the micropython board to the local disk
@@ -83,38 +109,25 @@ rcopy(MPath("/lib"), Path("./lib2"))
83109
84110## Installation
85111
86- First, clone this github repo into a folder somewhere:
87-
88- ``` bash
89- git clone https://github.com/glenn20/mpremote-path
90- cd mpremote-path
91- ```
92-
93112If you use a python virtual environment (recommended), make sure it is active.
94113
95- To install in your python environment:
96-
97- - Prerequisites (` mpremote ` ):
114+ ### Install from PYPI
98115
99- ``` bash
100- pip install -r requirements.txt
101- ```
116+ - Using pip: ` pip install mpremote-path ` , or
117+ - Using uv: ` uv pip install mpremote-path ` .
102118
103- - Install in [ "editable
104- mode"] ( https://setuptools.pypa.io/en/latest/userguide/development_mode.html ) :
119+ ### Install from github source
105120
106- ``` bash
107- pip install -e .
108- ```
121+ I recommend using uv to install and manage dependencies and dev environments.
109122
110- - OR build and install a distributable ` .whl ` package
111-
112- ``` bash
113- python -m build
114- pip install dist/mpremote-path* .whl
115- ```
123+ ``` bash
124+ git clone https://github.com/glenn20/mpremote-path
125+ cd mpremote-path
126+ uv build # To build an installable .whl file
127+ uv tool install dist/mpremote-path-0.1.4-py3-none-any .whl
128+ ```
116129
117- * Optional* : Run the test suite (requires pytest module: ` pip install pytest ` ):
130+ * Optional* : Run the test suite with: ` uv run pytest` or ` uv run tox ` .
118131
119132- Warning: running these tests will create and delete files and subdirectories
120133in a new folder on the micropython board: ` /_tests ` .
@@ -209,7 +222,7 @@ tests/test_recursive_copy.py::test_recursive_rm PASSED [100%]
209222 ` with_segments(*pathsegments) `
210223 - * Operators* :
211224 - ` / ` : the slash operator concatenates path segments to create child paths,
212- - eg. ` lib = MPRemotePath("/lib); pkg_dir = lib / "pkg" ` .
225+ - eg. ` lib = MPRemotePath("/lib" ); pkg_dir = lib / "pkg" ` .
213226
214227- Inherits or overrides from
215228 [ pathlib.Path] ( https://docs.python.org/3/library/pathlib.html#pathlib.Path ) :
@@ -219,11 +232,12 @@ tests/test_recursive_copy.py::test_recursive_rm PASSED [100%]
219232 ` group() ` , ` is_dir() ` , ` is_file() ` , ` is_junction() ` , ` is_mount() ` ,
220233 ` samefile(other) ` , ` is_symlink() ` , ` is_socket() ` , ` is_fifo() ` ,
221234 ` is_block_device() ` , ` is_char_device() ` , ` iterdir() ` , ` walk() ` , ` lstat() ` ,
222- ` mkdir() ` , ` owner() ` , ` read_bytes() ` , ` read_text() ` , ` rename(target) ` ,
223- ` replace(target) ` , ` absolute() ` , ` resolve() ` , ` rglob(pattern) ` , ` rmdir() ` ,
224- ` touch() ` , ` unlink() ` , ` write_bytes(data) ` , ` write_text(text) `
235+ ` mkdir() ` , ` owner() ` , ` open() ` , ` read_bytes() ` , ` read_text() ` ,
236+ ` rename(target) ` , ` replace(target) ` , ` absolute() ` , ` resolve() ` ,
237+ ` rglob(pattern) ` , ` rmdir() ` , ` touch() ` , ` unlink() ` , ` write_bytes(data) ` ,
238+ ` write_text(text) `
225239 - * Will raise a ` NotImplemented ` exception* :
226- - ` chmod() ` , ` lchmod() ` , ` open() ` , ` read_link() ` , ` symlimk_to(target) ` ,
240+ - ` chmod() ` , ` lchmod() ` , ` read_link() ` , ` symlimk_to(target) ` ,
227241 ` hardlink_to(target) `
228242
229243## ` mpremote_path.util.mpfs ` module
0 commit comments