mpytool 2.3.3__tar.gz → 2.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. mpytool-2.3.5/.github/workflows/integration.yml +53 -0
  2. mpytool-2.3.5/.github/workflows/publish.yml +35 -0
  3. mpytool-2.3.5/.github/workflows/tests.yml +29 -0
  4. mpytool-2.3.5/.gitignore +12 -0
  5. {mpytool-2.3.3/mpytool.egg-info → mpytool-2.3.5}/PKG-INFO +27 -16
  6. mpytool-2.3.3/PKG-INFO → mpytool-2.3.5/README.md +24 -27
  7. mpytool-2.3.5/README_API.md +1339 -0
  8. mpytool-2.3.5/README_bench.md +115 -0
  9. mpytool-2.3.5/README_mpremote.md +159 -0
  10. mpytool-2.3.5/completions/_mpytool +404 -0
  11. mpytool-2.3.5/completions/mpytool.bash +391 -0
  12. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/__init__.py +1 -1
  13. mpytool-2.3.5/mpytool/_version.py +34 -0
  14. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/conn.py +3 -2
  15. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/conn_serial.py +3 -6
  16. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/mount.py +39 -4
  17. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/mpy_comm.py +135 -11
  18. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/mpytool.py +81 -28
  19. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/utils.py +78 -8
  20. mpytool-2.3.3/README.md → mpytool-2.3.5/mpytool.egg-info/PKG-INFO +38 -13
  21. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool.egg-info/SOURCES.txt +11 -0
  22. {mpytool-2.3.3 → mpytool-2.3.5}/pyproject.toml +10 -4
  23. mpytool-2.3.5/tests/__init__.py +0 -0
  24. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_mpy.py +355 -0
  25. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_mpytool.py +69 -27
  26. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_utils.py +96 -0
  27. {mpytool-2.3.3 → mpytool-2.3.5}/LICENSE +0 -0
  28. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/cmd_cp.py +0 -0
  29. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/conn_socket.py +0 -0
  30. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/logger.py +0 -0
  31. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/mpy.py +0 -0
  32. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/mpy_cross.py +0 -0
  33. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/speedtest.py +0 -0
  34. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/terminal.py +0 -0
  35. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/terminal_unix.py +0 -0
  36. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool/terminal_win.py +0 -0
  37. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool.egg-info/dependency_links.txt +0 -0
  38. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool.egg-info/entry_points.txt +0 -0
  39. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool.egg-info/requires.txt +0 -0
  40. {mpytool-2.3.3 → mpytool-2.3.5}/mpytool.egg-info/top_level.txt +0 -0
  41. {mpytool-2.3.3 → mpytool-2.3.5}/setup.cfg +0 -0
  42. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_cli.py +0 -0
  43. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_cmd_cp.py +0 -0
  44. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_errors.py +0 -0
  45. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_integration.py +0 -0
  46. {mpytool-2.3.3 → mpytool-2.3.5}/tests/test_mount.py +0 -0
@@ -0,0 +1,53 @@
1
+ name: Integration Tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ unit-tests:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: '3.13'
16
+ - run: pip install -e .
17
+ - run: python -m unittest discover tests/ -v
18
+
19
+ linux-integration:
20
+ runs-on: [self-hosted, Linux]
21
+ needs: unit-tests
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ device: [ESP32]
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - name: Install package
29
+ run: $HOME/actions-runner/.venv/bin/pip install -e .
30
+ - name: Integration tests (${{ matrix.device }})
31
+ run: |
32
+ export PATH="$HOME/actions-runner/.venv/bin:$PATH"
33
+ export MPYTOOL_TEST_PORT_RW="$(cat ~/actions-runner/.config/mpytool/${{ matrix.device }})"
34
+ python -m unittest tests.test_integration tests.test_cli -v
35
+
36
+ win-integration:
37
+ runs-on: [self-hosted, Windows]
38
+ needs: unit-tests
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ device: [ESP32S3]
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ - name: Install package
46
+ run: C:\actions-runner\.venv\Scripts\pip install -e .
47
+ shell: cmd
48
+ - name: Integration tests (${{ matrix.device }})
49
+ run: |
50
+ set PATH=C:\actions-runner\.venv\Scripts;%PATH%
51
+ set /p MPYTOOL_TEST_PORT_RW=<C:\actions-runner\.config\mpytool\${{ matrix.device }}
52
+ python -m unittest tests.test_integration tests.test_cli -v
53
+ shell: cmd
@@ -0,0 +1,35 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.14"
21
+
22
+ - name: Install build dependencies
23
+ run: pip install build
24
+
25
+ - name: Install package
26
+ run: pip install .
27
+
28
+ - name: Run unit tests
29
+ run: python -m unittest discover -v tests/
30
+
31
+ - name: Build package
32
+ run: python -m build
33
+
34
+ - name: Publish to PyPI
35
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,29 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest]
15
+ python-version: ["3.10", "3.14"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install package
26
+ run: pip install .
27
+
28
+ - name: Run unit tests
29
+ run: python -m unittest discover -v tests/
@@ -0,0 +1,12 @@
1
+ __pycache__
2
+ build
3
+ dist
4
+ .*
5
+ !.gitignore
6
+ !.github
7
+ !.mpyproject
8
+ *.egg-info
9
+ _version.py
10
+ *.md
11
+ !README*.md
12
+ scripts/
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpytool
3
- Version: 2.3.3
3
+ Version: 2.3.5
4
4
  Summary: MPY tool - manage files on devices running MicroPython
5
- Author-email: Pavel Revak <pavel.revak@gmail.com>
5
+ Author-email: Pavel Revak <pavelrevak@gmail.com>
6
6
  License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/pavelrevak/mpytool
7
+ Project-URL: Homepage, https://github.com/cortexm/mpytool
8
8
  Keywords: MPY,micropython
9
9
  Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
@@ -55,7 +55,7 @@ pip3 install mpytool
55
55
  ### Installation from git (latest development version)
56
56
 
57
57
  ```bash
58
- pip3 install git+https://github.com/pavelrevak/mpytool.git
58
+ pip3 install git+https://github.com/cortexm/mpytool.git
59
59
  ```
60
60
 
61
61
  ### Installation in virtualenv
@@ -254,7 +254,11 @@ RESET soft
254
254
  $ mpytool reset --machine # MCU reset (machine.reset, auto-reconnect)
255
255
  RESET machine
256
256
 
257
- $ mpytool reset -- monitor # reset and monitor output
257
+ $ mpytool reset -- monitor # reset and monitor until program ends
258
+ RESET soft
259
+ MONITOR (until program ends, -f to follow)
260
+
261
+ $ mpytool reset -- monitor -f # reset and monitor continuously
258
262
  RESET soft
259
263
  MONITOR (Ctrl+C to stop)
260
264
 
@@ -275,7 +279,8 @@ REPL (Ctrl+] to exit) CWD: / PATH: : :.frozen :/lib
275
279
 
276
280
  $ mpytool -p /dev/ttyUSB0 repl # specify port
277
281
  $ mpytool -b 9600 repl # specify baudrate
278
- $ mpytool -p /dev/ttyUSB0 -b 9600 monitor # monitor at 9600 baud
282
+ $ mpytool -p /dev/ttyUSB0 -b 9600 monitor # monitor until program ends
283
+ $ mpytool monitor -f # follow output continuously (Ctrl-C to stop)
279
284
  ```
280
285
 
281
286
  The `repl` command with `-v` flag displays current working directory (CWD) and `sys.path` before entering REPL, making it easy to see the device state after `mount`, `cd`, or `path` commands.
@@ -284,24 +289,30 @@ Both `repl` and `monitor` can be used as general-purpose serial tools - not just
284
289
 
285
290
  ### Execute Python code on device
286
291
  ```
287
- $ mpytool exec "print('Hello!')"
292
+ $ mpytool exec "print('Hello!')" # execute and stream output
288
293
  EXEC: print('Hello!')
289
294
  Hello!
290
295
 
291
296
  $ mpytool exec "import sys; print(sys.version)"
292
297
  EXEC: import sys; print(sys.version)
293
298
  3.4.0; MicroPython v1.24.0
299
+
300
+ $ mpytool exec "long_task()" -t 30 # timeout after 30 seconds
301
+ $ mpytool exec "start_server()" -t 0 # fire-and-forget (don't wait)
294
302
  ```
295
303
 
296
304
  ### Run local Python file on device
297
305
  ```
298
- $ mpytool run script.py # run script (fire-and-forget)
306
+ $ mpytool run script.py # run and stream output
307
+ RUN: script.py (128 bytes)
308
+ Hello from script!
309
+
310
+ $ mpytool run script.py -t 0 # fire-and-forget (don't wait)
299
311
  RUN: script.py (128 bytes)
300
312
 
301
- $ mpytool run script.py -- monitor # run script and capture output
313
+ $ mpytool run script.py -t 10 # timeout after 10 seconds
302
314
  RUN: script.py (128 bytes)
303
- MONITOR (Ctrl+C to stop)
304
- Hello from script!
315
+ Done!
305
316
  ```
306
317
 
307
318
  ### Edit file on device
@@ -650,7 +661,7 @@ autoload -Uz compinit && compinit
650
661
  **Quick install (or update):**
651
662
  ```bash
652
663
  mkdir -p ~/.zsh/completions
653
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/_mpytool -o ~/.zsh/completions/_mpytool
664
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/_mpytool -o ~/.zsh/completions/_mpytool
654
665
  grep -q '\.zsh/completions' ~/.zshrc || echo 'fpath=(~/.zsh/completions $fpath); autoload -Uz compinit && compinit' >> ~/.zshrc
655
666
  exec zsh
656
667
  ```
@@ -671,17 +682,17 @@ source ~/.mpytool-completion.bash
671
682
 
672
683
  **Quick install (Linux system-wide):**
673
684
  ```bash
674
- sudo curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o /etc/bash_completion.d/mpytool && exec bash
685
+ sudo curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o /etc/bash_completion.d/mpytool && exec bash
675
686
  ```
676
687
 
677
688
  **Quick install (macOS Homebrew):**
678
689
  ```bash
679
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o /usr/local/etc/bash_completion.d/mpytool && exec bash
690
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o /usr/local/etc/bash_completion.d/mpytool && exec bash
680
691
  ```
681
692
 
682
693
  **Quick install (user directory):**
683
694
  ```bash
684
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o ~/.mpytool-completion.bash
695
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o ~/.mpytool-completion.bash
685
696
  grep -q 'mpytool-completion' ~/.bashrc || echo 'source ~/.mpytool-completion.bash' >> ~/.bashrc
686
697
  exec bash
687
698
  ```
@@ -757,4 +768,4 @@ MIT
757
768
  ### Support
758
769
 
759
770
  - Basic support is free over GitHub issues.
760
- - Professional support is available over email: [Pavel Revak](mailto:pavel.revak@gmail.com?subject=[GitHub]%20mpytool).
771
+ - Professional support is available over email: [Pavel Revak](mailto:pavelrevak@gmail.com?subject=[GitHub]%20mpytool).
@@ -1,17 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: mpytool
3
- Version: 2.3.3
4
- Summary: MPY tool - manage files on devices running MicroPython
5
- Author-email: Pavel Revak <pavel.revak@gmail.com>
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/pavelrevak/mpytool
8
- Keywords: MPY,micropython
9
- Requires-Python: >=3.10
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: pyserial>=3.0
13
- Dynamic: license-file
14
-
15
1
  # mpytool
16
2
 
17
3
  MPY tool - manage files on devices running MicroPython
@@ -55,7 +41,7 @@ pip3 install mpytool
55
41
  ### Installation from git (latest development version)
56
42
 
57
43
  ```bash
58
- pip3 install git+https://github.com/pavelrevak/mpytool.git
44
+ pip3 install git+https://github.com/cortexm/mpytool.git
59
45
  ```
60
46
 
61
47
  ### Installation in virtualenv
@@ -254,7 +240,11 @@ RESET soft
254
240
  $ mpytool reset --machine # MCU reset (machine.reset, auto-reconnect)
255
241
  RESET machine
256
242
 
257
- $ mpytool reset -- monitor # reset and monitor output
243
+ $ mpytool reset -- monitor # reset and monitor until program ends
244
+ RESET soft
245
+ MONITOR (until program ends, -f to follow)
246
+
247
+ $ mpytool reset -- monitor -f # reset and monitor continuously
258
248
  RESET soft
259
249
  MONITOR (Ctrl+C to stop)
260
250
 
@@ -275,7 +265,8 @@ REPL (Ctrl+] to exit) CWD: / PATH: : :.frozen :/lib
275
265
 
276
266
  $ mpytool -p /dev/ttyUSB0 repl # specify port
277
267
  $ mpytool -b 9600 repl # specify baudrate
278
- $ mpytool -p /dev/ttyUSB0 -b 9600 monitor # monitor at 9600 baud
268
+ $ mpytool -p /dev/ttyUSB0 -b 9600 monitor # monitor until program ends
269
+ $ mpytool monitor -f # follow output continuously (Ctrl-C to stop)
279
270
  ```
280
271
 
281
272
  The `repl` command with `-v` flag displays current working directory (CWD) and `sys.path` before entering REPL, making it easy to see the device state after `mount`, `cd`, or `path` commands.
@@ -284,24 +275,30 @@ Both `repl` and `monitor` can be used as general-purpose serial tools - not just
284
275
 
285
276
  ### Execute Python code on device
286
277
  ```
287
- $ mpytool exec "print('Hello!')"
278
+ $ mpytool exec "print('Hello!')" # execute and stream output
288
279
  EXEC: print('Hello!')
289
280
  Hello!
290
281
 
291
282
  $ mpytool exec "import sys; print(sys.version)"
292
283
  EXEC: import sys; print(sys.version)
293
284
  3.4.0; MicroPython v1.24.0
285
+
286
+ $ mpytool exec "long_task()" -t 30 # timeout after 30 seconds
287
+ $ mpytool exec "start_server()" -t 0 # fire-and-forget (don't wait)
294
288
  ```
295
289
 
296
290
  ### Run local Python file on device
297
291
  ```
298
- $ mpytool run script.py # run script (fire-and-forget)
292
+ $ mpytool run script.py # run and stream output
299
293
  RUN: script.py (128 bytes)
294
+ Hello from script!
300
295
 
301
- $ mpytool run script.py -- monitor # run script and capture output
296
+ $ mpytool run script.py -t 0 # fire-and-forget (don't wait)
302
297
  RUN: script.py (128 bytes)
303
- MONITOR (Ctrl+C to stop)
304
- Hello from script!
298
+
299
+ $ mpytool run script.py -t 10 # timeout after 10 seconds
300
+ RUN: script.py (128 bytes)
301
+ Done!
305
302
  ```
306
303
 
307
304
  ### Edit file on device
@@ -650,7 +647,7 @@ autoload -Uz compinit && compinit
650
647
  **Quick install (or update):**
651
648
  ```bash
652
649
  mkdir -p ~/.zsh/completions
653
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/_mpytool -o ~/.zsh/completions/_mpytool
650
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/_mpytool -o ~/.zsh/completions/_mpytool
654
651
  grep -q '\.zsh/completions' ~/.zshrc || echo 'fpath=(~/.zsh/completions $fpath); autoload -Uz compinit && compinit' >> ~/.zshrc
655
652
  exec zsh
656
653
  ```
@@ -671,17 +668,17 @@ source ~/.mpytool-completion.bash
671
668
 
672
669
  **Quick install (Linux system-wide):**
673
670
  ```bash
674
- sudo curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o /etc/bash_completion.d/mpytool && exec bash
671
+ sudo curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o /etc/bash_completion.d/mpytool && exec bash
675
672
  ```
676
673
 
677
674
  **Quick install (macOS Homebrew):**
678
675
  ```bash
679
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o /usr/local/etc/bash_completion.d/mpytool && exec bash
676
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o /usr/local/etc/bash_completion.d/mpytool && exec bash
680
677
  ```
681
678
 
682
679
  **Quick install (user directory):**
683
680
  ```bash
684
- curl -fsSL https://raw.githubusercontent.com/pavelrevak/mpytool/main/completions/mpytool.bash -o ~/.mpytool-completion.bash
681
+ curl -fsSL https://raw.githubusercontent.com/cortexm/mpytool/main/completions/mpytool.bash -o ~/.mpytool-completion.bash
685
682
  grep -q 'mpytool-completion' ~/.bashrc || echo 'source ~/.mpytool-completion.bash' >> ~/.bashrc
686
683
  exec bash
687
684
  ```
@@ -757,4 +754,4 @@ MIT
757
754
  ### Support
758
755
 
759
756
  - Basic support is free over GitHub issues.
760
- - Professional support is available over email: [Pavel Revak](mailto:pavel.revak@gmail.com?subject=[GitHub]%20mpytool).
757
+ - Professional support is available over email: [Pavel Revak](mailto:pavelrevak@gmail.com?subject=[GitHub]%20mpytool).