mposcli 0.7.0__tar.gz → 0.8.0__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 (54) hide show
  1. {mposcli-0.7.0 → mposcli-0.8.0}/.pre-commit-config.yaml +1 -1
  2. {mposcli-0.7.0 → mposcli-0.8.0}/PKG-INFO +26 -12
  3. {mposcli-0.7.0 → mposcli-0.8.0}/README.md +25 -11
  4. mposcli-0.8.0/dist/.gitignore +1 -0
  5. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/__init__.py +1 -1
  6. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/build.py +3 -3
  7. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/copy_mpos.py +5 -5
  8. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/flash.py +2 -2
  9. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/run_deskop.py +2 -2
  10. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/shell.py +2 -2
  11. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/update.py +49 -17
  12. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/code_style.py +1 -1
  13. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/packaging.py +1 -1
  14. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/shell_completion.py +2 -2
  15. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/testing.py +1 -1
  16. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/update_readme_history.py +1 -1
  17. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/fs_utils.py +1 -1
  18. mposcli-0.8.0/mposcli/shared_tyro.py +17 -0
  19. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/test_mpremote_cp_utils.py +2 -2
  20. mposcli-0.8.0/mposcli/utilities/__init__.py +0 -0
  21. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/utilities/mpremote.py +2 -13
  22. {mposcli-0.7.0 → mposcli-0.8.0}/uv.lock +416 -387
  23. {mposcli-0.7.0 → mposcli-0.8.0}/.editorconfig +0 -0
  24. {mposcli-0.7.0 → mposcli-0.8.0}/.github/workflows/tests.yml +0 -0
  25. {mposcli-0.7.0 → mposcli-0.8.0}/.gitignore +0 -0
  26. {mposcli-0.7.0 → mposcli-0.8.0}/.idea/.gitignore +0 -0
  27. {mposcli-0.7.0 → mposcli-0.8.0}/.pre-commit-hooks.yaml +0 -0
  28. {mposcli-0.7.0 → mposcli-0.8.0}/.run/Template Python tests.run.xml +0 -0
  29. {mposcli-0.7.0 → mposcli-0.8.0}/.run/Template Python.run.xml +0 -0
  30. {mposcli-0.7.0 → mposcli-0.8.0}/.run/Unittests __all__.run.xml +0 -0
  31. {mposcli-0.7.0 → mposcli-0.8.0}/.run/cli --help.run.xml +0 -0
  32. {mposcli-0.7.0 → mposcli-0.8.0}/.run/dev-cli --help.run.xml +0 -0
  33. {mposcli-0.7.0 → mposcli-0.8.0}/.run/dev-cli test.run.xml +0 -0
  34. {mposcli-0.7.0 → mposcli-0.8.0}/.venv-app/.gitignore +0 -0
  35. {mposcli-0.7.0/dist → mposcli-0.8.0/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.cache/uv}/.gitignore +0 -0
  36. /mposcli-0.7.0/mposcli/utilities/__init__.py → /mposcli-0.8.0/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.cache/uv/sdists-v9/.gitignore +0 -0
  37. {mposcli-0.7.0 → mposcli-0.8.0}/.venv-app/lib/python3.14/site-packages/cli_base/tests/shell_complete_snapshots/.gitignore +0 -0
  38. {mposcli-0.7.0 → mposcli-0.8.0}/cli.py +0 -0
  39. {mposcli-0.7.0 → mposcli-0.8.0}/dev-cli.py +0 -0
  40. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/__main__.py +0 -0
  41. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_app/__init__.py +0 -0
  42. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/__init__.py +0 -0
  43. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/cli_dev/__main__.py +0 -0
  44. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/constants.py +0 -0
  45. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/mpos_utils.py +0 -0
  46. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/__init__.py +0 -0
  47. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/test_doctests.py +0 -0
  48. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/test_project_setup.py +0 -0
  49. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/test_readme.py +0 -0
  50. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tests/test_readme_history.py +0 -0
  51. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/tools.py +0 -0
  52. {mposcli-0.7.0 → mposcli-0.8.0}/mposcli/user_input.py +0 -0
  53. {mposcli-0.7.0 → mposcli-0.8.0}/noxfile.py +0 -0
  54. {mposcli-0.7.0 → mposcli-0.8.0}/pyproject.toml +0 -0
@@ -2,6 +2,6 @@
2
2
  # See https://pre-commit.com for more information
3
3
  repos:
4
4
  - repo: https://github.com/jedie/cli-base-utilities
5
- rev: v0.28.0
5
+ rev: v0.29.0
6
6
  hooks:
7
7
  - id: update-readme-history
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mposcli
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: CLI helper for MicroPythonOS: https://github.com/MicroPythonOS/MicroPythonOS
5
5
  Project-URL: Documentation, https://github.com/jedie/mposcli
6
6
  Project-URL: Source, https://github.com/jedie/mposcli
@@ -97,13 +97,13 @@ submodules,version}
97
97
 
98
98
  [comment]: <> (✂✂✂ auto generated build start ✂✂✂)
99
99
  ```
100
- usage: mposcli build [-h] [{esp32,esp32s3,unphone,unix,macOS}] [-v]
100
+ usage: mposcli build [-h] [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] [-v]
101
101
 
102
102
  Build MicroPythonOS by calling: ./scripts/build_mpos.sh <target> see:
103
103
  https://docs.micropythonos.com/os-development/
104
104
 
105
105
  ╭─ positional arguments ───────────────────────────────────────────────────╮
106
- │ [{esp32,esp32s3,unphone,unix,macOS}]
106
+ │ [{esp32,esp32-small,esp32s3,unphone,unix,macOS}]
107
107
  │ Target platform to build for. (default: unix) │
108
108
  ╰──────────────────────────────────────────────────────────────────────────╯
109
109
  ╭─ options ────────────────────────────────────────────────────────────────╮
@@ -244,8 +244,7 @@ the REPL. The goal it to try to get a REPL in a loop until it works.
244
244
 
245
245
  [comment]: <> (✂✂✂ auto generated update start ✂✂✂)
246
246
  ```
247
- usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
248
- clone] [-v]
247
+ usage: mposcli update [-h] [UPDATE OPTIONS]
249
248
 
250
249
  Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
251
250
  configured. Will also ask if you want to update the submodules as well, which is
@@ -257,7 +256,11 @@ recommended.
257
256
  │ Cleanup unnecessary files and optimize the local repository, too? │
258
257
  │ (default: True) │
259
258
  │ --shallow-clone, --no-shallow-clone │
260
- │ Submodules only a shallow clone with --depth=1? (default: False)
259
+ │ Submodules only a shallow clone with --depth=1? (default: True)
260
+ │ --reset-submodules, --no-reset-submodules │
261
+ │ Drop and recreate all submodules? (Takes a while) (default: False) │
262
+ │ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
263
+ │ update in parallel (default: 16) │
261
264
  │ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
262
265
  ╰────────────────────────────────────────────────────────────────────────────────────────╯
263
266
  ```
@@ -271,8 +274,7 @@ recommended.
271
274
 
272
275
  [comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
273
276
  ```
274
- usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
275
- shallow-clone] [-v]
277
+ usage: mposcli update-submodules [-h] [UPDATE-SUBMODULES OPTIONS]
276
278
 
277
279
  Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
278
280
  repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
@@ -284,7 +286,11 @@ development/linux/#optional-updating-the-code
284
286
  │ Cleanup unnecessary files and optimize the local repository, too? │
285
287
  │ (default: True) │
286
288
  │ --shallow-clone, --no-shallow-clone │
287
- │ Submodules only a shallow clone with --depth=1? (default: False)
289
+ │ Submodules only a shallow clone with --depth=1? (default: True)
290
+ │ --reset-submodules, --no-reset-submodules │
291
+ │ Drop and recreate all submodules? (Takes a while) (default: False) │
292
+ │ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
293
+ │ update in parallel (default: 16) │
288
294
  │ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
289
295
  ╰────────────────────────────────────────────────────────────────────────────────────────╯
290
296
  ```
@@ -355,11 +361,22 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
355
361
 
356
362
  [comment]: <> (✂✂✂ auto generated history start ✂✂✂)
357
363
 
364
+ * [v0.8.0](https://github.com/jedie/mposcli/compare/v0.7.1...v0.8.0)
365
+ * 2026-04-08 - Update build targets
366
+ * 2026-04-08 - Enhance git submodule update
367
+ * 2026-04-08 - update requirements
368
+ * 2026-03-31 - Fix local <-> device filesystem mapping
369
+ * [v0.7.1](https://github.com/jedie/mposcli/compare/v0.7.0...v0.7.1)
370
+ * 2026-03-24 - Warn if non executeable build found
371
+ * 2026-03-24 - Set log level to WARNING as default
358
372
  * [v0.7.0](https://github.com/jedie/mposcli/compare/v0.6.0...v0.7.0)
359
373
  * 2026-03-24 - Safe diskspace in mposcli update / update-submodules
360
374
  * 2026-03-22 - Use "retry loop" for copy, too
361
375
  * [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
362
376
  * 2026-03-21 - NEW: "shell" to start the REPL
377
+
378
+ <details><summary>Expand older history entries ...</summary>
379
+
363
380
  * [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
364
381
  * 2026-03-08 - update README
365
382
  * 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
@@ -367,9 +384,6 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
367
384
  * 2026-03-03 - flash command: use port auto detection as default
368
385
  * [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
369
386
  * 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
370
-
371
- <details><summary>Expand older history entries ...</summary>
372
-
373
387
  * [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
374
388
  * 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
375
389
  * 2026-02-24 - Log skipped files
@@ -82,13 +82,13 @@ submodules,version}
82
82
 
83
83
  [comment]: <> (✂✂✂ auto generated build start ✂✂✂)
84
84
  ```
85
- usage: mposcli build [-h] [{esp32,esp32s3,unphone,unix,macOS}] [-v]
85
+ usage: mposcli build [-h] [{esp32,esp32-small,esp32s3,unphone,unix,macOS}] [-v]
86
86
 
87
87
  Build MicroPythonOS by calling: ./scripts/build_mpos.sh <target> see:
88
88
  https://docs.micropythonos.com/os-development/
89
89
 
90
90
  ╭─ positional arguments ───────────────────────────────────────────────────╮
91
- │ [{esp32,esp32s3,unphone,unix,macOS}]
91
+ │ [{esp32,esp32-small,esp32s3,unphone,unix,macOS}]
92
92
  │ Target platform to build for. (default: unix) │
93
93
  ╰──────────────────────────────────────────────────────────────────────────╯
94
94
  ╭─ options ────────────────────────────────────────────────────────────────╮
@@ -229,8 +229,7 @@ the REPL. The goal it to try to get a REPL in a loop until it works.
229
229
 
230
230
  [comment]: <> (✂✂✂ auto generated update start ✂✂✂)
231
231
  ```
232
- usage: mposcli update [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-shallow-
233
- clone] [-v]
232
+ usage: mposcli update [-h] [UPDATE OPTIONS]
234
233
 
235
234
  Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote
236
235
  configured. Will also ask if you want to update the submodules as well, which is
@@ -242,7 +241,11 @@ recommended.
242
241
  │ Cleanup unnecessary files and optimize the local repository, too? │
243
242
  │ (default: True) │
244
243
  │ --shallow-clone, --no-shallow-clone │
245
- │ Submodules only a shallow clone with --depth=1? (default: False)
244
+ │ Submodules only a shallow clone with --depth=1? (default: True)
245
+ │ --reset-submodules, --no-reset-submodules │
246
+ │ Drop and recreate all submodules? (Takes a while) (default: False) │
247
+ │ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
248
+ │ update in parallel (default: 16) │
246
249
  │ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
247
250
  ╰────────────────────────────────────────────────────────────────────────────────────────╯
248
251
  ```
@@ -256,8 +259,7 @@ recommended.
256
259
 
257
260
  [comment]: <> (✂✂✂ auto generated update-submodules start ✂✂✂)
258
261
  ```
259
- usage: mposcli update-submodules [-h] [--cleanup | --no-cleanup] [--shallow-clone | --no-
260
- shallow-clone] [-v]
262
+ usage: mposcli update-submodules [-h] [UPDATE-SUBMODULES OPTIONS]
261
263
 
262
264
  Updates MicroPythonOS git submodules only. Use "mposcli update" to update the main
263
265
  repository and optionally the submodules as well. see: https://docs.micropythonos.com/os-
@@ -269,7 +271,11 @@ development/linux/#optional-updating-the-code
269
271
  │ Cleanup unnecessary files and optimize the local repository, too? │
270
272
  │ (default: True) │
271
273
  │ --shallow-clone, --no-shallow-clone │
272
- │ Submodules only a shallow clone with --depth=1? (default: False)
274
+ │ Submodules only a shallow clone with --depth=1? (default: True)
275
+ │ --reset-submodules, --no-reset-submodules │
276
+ │ Drop and recreate all submodules? (Takes a while) (default: False) │
277
+ │ --jobs INT git submodule update --jobs argument, i.e. how many submodules to │
278
+ │ update in parallel (default: 16) │
273
279
  │ -v, --verbosity Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable) │
274
280
  ╰────────────────────────────────────────────────────────────────────────────────────────╯
275
281
  ```
@@ -340,11 +346,22 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
340
346
 
341
347
  [comment]: <> (✂✂✂ auto generated history start ✂✂✂)
342
348
 
349
+ * [v0.8.0](https://github.com/jedie/mposcli/compare/v0.7.1...v0.8.0)
350
+ * 2026-04-08 - Update build targets
351
+ * 2026-04-08 - Enhance git submodule update
352
+ * 2026-04-08 - update requirements
353
+ * 2026-03-31 - Fix local <-> device filesystem mapping
354
+ * [v0.7.1](https://github.com/jedie/mposcli/compare/v0.7.0...v0.7.1)
355
+ * 2026-03-24 - Warn if non executeable build found
356
+ * 2026-03-24 - Set log level to WARNING as default
343
357
  * [v0.7.0](https://github.com/jedie/mposcli/compare/v0.6.0...v0.7.0)
344
358
  * 2026-03-24 - Safe diskspace in mposcli update / update-submodules
345
359
  * 2026-03-22 - Use "retry loop" for copy, too
346
360
  * [v0.6.0](https://github.com/jedie/mposcli/compare/v0.5.0...v0.6.0)
347
361
  * 2026-03-21 - NEW: "shell" to start the REPL
362
+
363
+ <details><summary>Expand older history entries ...</summary>
364
+
348
365
  * [v0.5.0](https://github.com/jedie/mposcli/compare/v0.4.1...v0.5.0)
349
366
  * 2026-03-08 - update README
350
367
  * 2026-03-05 - Enhance "cp" command and auto restart "mpremote repl"
@@ -352,9 +369,6 @@ completion,test,update,update-readme-history,update-test-snapshot-files,version}
352
369
  * 2026-03-03 - flash command: use port auto detection as default
353
370
  * [v0.4.1](https://github.com/jedie/mposcli/compare/v0.4.0...v0.4.1)
354
371
  * 2026-02-27 - Use "--force" for pulling submodules to overwrite local changes
355
-
356
- <details><summary>Expand older history entries ...</summary>
357
-
358
372
  * [v0.4.0](https://github.com/jedie/mposcli/compare/v0.3.0...v0.4.0)
359
373
  * 2026-02-24 - NEW command: "cp-app" to install/update internal_filesystem/apps
360
374
  * 2026-02-24 - Log skipped files
@@ -0,0 +1 @@
1
+ *
@@ -4,5 +4,5 @@
4
4
  """
5
5
 
6
6
  # See https://packaging.python.org/en/latest/specifications/version-specifiers/
7
- __version__ = '0.7.0'
7
+ __version__ = '0.8.0'
8
8
  __author__ = 'Jens Diemer <cookiecutter_templates@jensdiemer.de>'
@@ -5,11 +5,11 @@ import tyro
5
5
  from bx_py_utils.path import assert_is_file
6
6
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
7
7
  from cli_base.cli_tools.verbosity import setup_logging
8
- from cli_base.tyro_commands import TyroVerbosityArgType
9
8
  from rich import print # noqa
10
9
 
11
10
  from mposcli.cli_app import app
12
11
  from mposcli.mpos_utils import get_mpos_path
12
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
13
13
 
14
14
 
15
15
  logger = logging.getLogger(__name__)
@@ -18,13 +18,13 @@ logger = logging.getLogger(__name__)
18
18
  @app.command
19
19
  def build(
20
20
  target: Annotated[
21
- Literal['esp32', 'esp32s3', 'unphone', 'unix', 'macOS'],
21
+ Literal['esp32', 'esp32-small', 'esp32s3', 'unphone', 'unix', 'macOS'],
22
22
  tyro.conf.arg(
23
23
  help='Target platform to build for.',
24
24
  ),
25
25
  ] = 'unix',
26
26
  /,
27
- verbosity: TyroVerbosityArgType = 1,
27
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
28
28
  ):
29
29
  """
30
30
  Build MicroPythonOS by calling: ./scripts/build_mpos.sh <target>
@@ -7,11 +7,11 @@ import tyro
7
7
  from bx_py_utils.path import assert_is_dir
8
8
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
9
9
  from cli_base.cli_tools.verbosity import setup_logging
10
- from cli_base.tyro_commands import TyroVerbosityArgType
11
10
  from rich import print
12
11
 
13
12
  from mposcli.cli_app import app
14
13
  from mposcli.mpos_utils import get_mpos_path
14
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
15
15
  from mposcli.tools import get_mpremote_bin
16
16
  from mposcli.user_input import choose_newest_modified_directory, get_newest_files
17
17
  from mposcli.utilities.mpremote import MpOsPathResolver, check_call_loop, start_mpremote_repl
@@ -39,7 +39,7 @@ def cp(
39
39
  bool,
40
40
  tyro.conf.arg(help='After flashing/verify start REPL with mpremote to see the output of the device?'),
41
41
  ] = True,
42
- verbosity: TyroVerbosityArgType = 1,
42
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
43
43
  ):
44
44
  """
45
45
  Copy/update internal_filesystem/lib/mpos files to the device via "mpremote fs cp".
@@ -58,10 +58,10 @@ def cp(
58
58
 
59
59
  if not local_path:
60
60
  # Let's the user select from the list of the newest modified files in internal_filesystem/lib/mpos:
61
- local_path = get_newest_files(resolver.lib_mpos, limit=new_file_limit)
61
+ local_path = get_newest_files(resolver.internal_fs, limit=new_file_limit)
62
62
  if not local_path:
63
63
  print('Copy/update all files in lib/mpos to the device')
64
- local_path = resolver.lib_mpos
64
+ local_path = resolver.internal_fs
65
65
 
66
66
  print(f'Copy/update app: "{local_path}" ...')
67
67
 
@@ -112,7 +112,7 @@ def cp_app(
112
112
  bool,
113
113
  tyro.conf.arg(help='After flashing/verify start REPL with mpremote to see the output of the device?'),
114
114
  ] = True,
115
- verbosity: TyroVerbosityArgType = 1,
115
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
116
116
  ):
117
117
  """
118
118
  Copy/update internal_filesystem/apps to the device via "mpremote fs cp".
@@ -4,11 +4,11 @@ from typing import Annotated
4
4
  import tyro
5
5
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
6
6
  from cli_base.cli_tools.verbosity import setup_logging
7
- from cli_base.tyro_commands import TyroVerbosityArgType
8
7
  from rich import print
9
8
 
10
9
  from mposcli.cli_app import app
11
10
  from mposcli.mpos_utils import get_mpos_path
11
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
12
12
  from mposcli.tools import get_esptool_bin, get_mpremote_bin
13
13
  from mposcli.user_input import file_chooser
14
14
 
@@ -34,7 +34,7 @@ def flash(
34
34
  bool,
35
35
  tyro.conf.arg(help='After flashing/verify start REPL with mpremote to see the output of the device?'),
36
36
  ] = True,
37
- verbosity: TyroVerbosityArgType = 1,
37
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
38
38
  ):
39
39
  """
40
40
  Flash MicroPythonOS to the device. Display a file chooser to select the image to flash.
@@ -9,12 +9,12 @@ import tyro
9
9
  from bx_py_utils.path import assert_is_file
10
10
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
11
11
  from cli_base.cli_tools.verbosity import setup_logging
12
- from cli_base.tyro_commands import TyroVerbosityArgType
13
12
  from rich import print
14
13
 
15
14
  from mposcli.cli_app import app
16
15
  from mposcli.fs_utils import list_executables
17
16
  from mposcli.mpos_utils import get_mpos_path
17
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
18
18
  from mposcli.user_input import file_chooser
19
19
 
20
20
 
@@ -40,7 +40,7 @@ def run_desktop(
40
40
  ' If omitted, shows a file chooser to select one from the lvgl_micropython build directory.'
41
41
  ),
42
42
  ] = None,
43
- verbosity: TyroVerbosityArgType = 1,
43
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
44
44
  ):
45
45
  """
46
46
  Run MicroPythonOS on desktop.
@@ -5,10 +5,10 @@ from typing import Annotated
5
5
  import tyro
6
6
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
7
7
  from cli_base.cli_tools.verbosity import setup_logging
8
- from cli_base.tyro_commands import TyroVerbosityArgType
9
8
 
10
9
  from mposcli.cli_app import app
11
10
  from mposcli.mpos_utils import get_mpos_path
11
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
12
12
  from mposcli.tools import get_mpremote_bin
13
13
  from mposcli.utilities.mpremote import start_mpremote_repl
14
14
 
@@ -22,7 +22,7 @@ def shell(
22
22
  bool,
23
23
  tyro.conf.arg(help='Reset the device before starting the REPL?'),
24
24
  ] = False,
25
- verbosity: TyroVerbosityArgType = 1,
25
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
26
26
  ):
27
27
  """
28
28
  Start a REPL shell connected to the device using mpremote. Optional reset before starting the REPL.
@@ -5,33 +5,45 @@ from typing import Annotated
5
5
  import tyro
6
6
  from cli_base.cli_tools.git import Git
7
7
  from cli_base.cli_tools.verbosity import setup_logging
8
- from cli_base.tyro_commands import TyroVerbosityArgType
9
8
  from rich import print
10
9
 
11
10
  from mposcli.cli_app import app
12
11
  from mposcli.mpos_utils import get_mpos_path
12
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
13
13
 
14
14
 
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
+ GIT_JOBS_DEFAULT = 16
17
18
 
18
- def _update_submodules(git: Git, *, cleanup, shallow_clone):
19
- if shallow_clone:
20
- git.git_verbose_check_call('submodule', 'deinit', '-f', '--all')
19
+
20
+ def _update_submodules(git: Git, *, cleanup, shallow_clone, reset_submodules, jobs: int):
21
+ if reset_submodules:
22
+ git.git_verbose_check_call('submodule', 'deinit', '--force', '--all')
21
23
  modules_path = git.cwd / '.git' / 'modules'
22
24
  if modules_path.exists():
23
25
  shutil.rmtree(modules_path)
24
- git.git_verbose_check_call('submodule', 'update', '--init', '--depth', '1', '--recursive')
26
+ git.git_verbose_check_call('gc', '--aggressive', '--prune=now')
27
+
28
+ args = ('submodule', 'update', '--init', '--recursive', '--jobs', str(jobs))
29
+ if shallow_clone:
30
+ args += ('--depth', '1')
31
+ git.git_verbose_check_call(*args)
25
32
  else:
33
+ git.git_verbose_check_call('submodule', 'sync', '--recursive')
34
+ git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'reset', '--hard')
35
+ git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'clean', '-ffdx')
36
+ git.git_verbose_check_call('submodule', 'foreach', '--recursive', 'git', 'fetch', '--all', '--jobs', str(jobs))
37
+
38
+ args = ('submodule', 'update', '--init', '--recursive', '--force', '--jobs', str(jobs))
39
+ if shallow_clone:
40
+ args += ('--depth', '1')
41
+ git.git_verbose_check_call(*args)
42
+
43
+ if cleanup:
26
44
  git.git_verbose_check_call(
27
- 'submodule', 'foreach', '--recursive', 'git', 'clean', '-f', ';', 'git', 'checkout', '.'
45
+ 'submodule', 'foreach', '--recursive', 'git', 'gc', '--prune=now',
28
46
  )
29
- git.git_verbose_check_call('pull', '--recurse-submodules', '--force')
30
-
31
- if cleanup:
32
- git.git_verbose_check_call(
33
- 'submodule', 'foreach', '--recursive', 'git', 'gc', '--aggressive', '--prune=now'
34
- )
35
47
 
36
48
 
37
49
  @app.command
@@ -43,8 +55,16 @@ def update_submodules(
43
55
  shallow_clone: Annotated[
44
56
  bool,
45
57
  tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
58
+ ] = True,
59
+ reset_submodules: Annotated[
60
+ bool,
61
+ tyro.conf.arg(help='Drop and recreate all submodules? (Takes a while)'),
46
62
  ] = False,
47
- verbosity: TyroVerbosityArgType = 1,
63
+ jobs: Annotated[
64
+ int,
65
+ tyro.conf.arg(help='git submodule update --jobs argument, i.e. how many submodules to update in parallel'),
66
+ ] = GIT_JOBS_DEFAULT,
67
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
48
68
  ):
49
69
  """
50
70
  Updates MicroPythonOS git submodules only.
@@ -54,7 +74,7 @@ def update_submodules(
54
74
  setup_logging(verbosity=verbosity)
55
75
  mpos_path = get_mpos_path()
56
76
  git = Git(cwd=mpos_path)
57
- _update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone)
77
+ _update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone, reset_submodules=reset_submodules, jobs=jobs)
58
78
 
59
79
 
60
80
  @app.command
@@ -66,8 +86,16 @@ def update(
66
86
  shallow_clone: Annotated[
67
87
  bool,
68
88
  tyro.conf.arg(help='Submodules only a shallow clone with --depth=1?'),
89
+ ] = True,
90
+ reset_submodules: Annotated[
91
+ bool,
92
+ tyro.conf.arg(help='Drop and recreate all submodules? (Takes a while)'),
69
93
  ] = False,
70
- verbosity: TyroVerbosityArgType = 1,
94
+ jobs: Annotated[
95
+ int,
96
+ tyro.conf.arg(help='git submodule update --jobs argument, i.e. how many submodules to update in parallel'),
97
+ ] = GIT_JOBS_DEFAULT,
98
+ verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY,
71
99
  ):
72
100
  """
73
101
  Update MicroPythonOS repository. Assume that there is a "origin" and/or "upstream" remote configured.
@@ -88,7 +116,9 @@ def update(
88
116
 
89
117
  for remote_name in ('origin', 'upstream'):
90
118
  if remote_name in remotes:
91
- git.git_verbose_check_call('rebase', '--no-verify', f'{remote_name}/{main_branch_name}', exit_on_error=True)
119
+ git.git_verbose_check_call(
120
+ 'rebase', '--no-verify', f'{remote_name}/{main_branch_name}', '--force', exit_on_error=True
121
+ )
92
122
  else:
93
123
  print(f'[yellow]Remote "{remote_name}" not found, skipping rebase to it.')
94
124
 
@@ -99,4 +129,6 @@ def update(
99
129
  print('\n')
100
130
  if input('Do you want to update submodules as well? [Y/n] (default: Yes): ') in ('y', ''):
101
131
  print('\nUpdating submodules...\n')
102
- _update_submodules(git, cleanup=cleanup, shallow_clone=shallow_clone)
132
+ _update_submodules(
133
+ git, cleanup=cleanup, shallow_clone=shallow_clone, reset_submodules=reset_submodules, jobs=jobs
134
+ )
@@ -1,7 +1,7 @@
1
1
  from cli_base.cli_tools.code_style import assert_code_style
2
- from cli_base.tyro_commands import TyroVerbosityArgType
3
2
 
4
3
  from mposcli.cli_dev import PACKAGE_ROOT, app
4
+ from mposcli.shared_tyro import TyroVerbosityArgType
5
5
 
6
6
 
7
7
  @app.command
@@ -4,11 +4,11 @@ from cli_base.cli_tools.dev_tools import run_unittest_cli
4
4
  from cli_base.cli_tools.subprocess_utils import ToolsExecutor
5
5
  from cli_base.cli_tools.verbosity import setup_logging
6
6
  from cli_base.run_pip_audit import run_pip_audit
7
- from cli_base.tyro_commands import TyroVerbosityArgType
8
7
  from manageprojects.utilities.publish import publish_package
9
8
 
10
9
  import mposcli
11
10
  from mposcli.cli_dev import PACKAGE_ROOT, app
11
+ from mposcli.shared_tyro import TyroVerbosityArgType
12
12
 
13
13
 
14
14
  logger = logging.getLogger(__name__)
@@ -2,17 +2,17 @@ import logging
2
2
 
3
3
  from cli_base.cli_tools.shell_completion import setup_tyro_shell_completion
4
4
  from cli_base.cli_tools.verbosity import setup_logging
5
- from cli_base.tyro_commands import TyroVerbosityArgType
6
5
  from rich import print # noqa
7
6
 
8
7
  from mposcli.cli_dev import app
8
+ from mposcli.shared_tyro import DEFAULT_VERBOSITY, TyroVerbosityArgType
9
9
 
10
10
 
11
11
  logger = logging.getLogger(__name__)
12
12
 
13
13
 
14
14
  @app.command
15
- def shell_completion(verbosity: TyroVerbosityArgType = 1, remove: bool = False) -> None:
15
+ def shell_completion(verbosity: TyroVerbosityArgType = DEFAULT_VERBOSITY, remove: bool = False) -> None:
16
16
  """
17
17
  Setup shell completion for this CLI (Currently only for bash shell)
18
18
  """
@@ -1,9 +1,9 @@
1
1
  from cli_base.cli_tools.dev_tools import run_coverage, run_nox, run_unittest_cli
2
2
  from cli_base.cli_tools.subprocess_utils import verbose_check_call
3
3
  from cli_base.cli_tools.test_utils.snapshot import UpdateTestSnapshotFiles
4
- from cli_base.tyro_commands import TyroVerbosityArgType
5
4
 
6
5
  from mposcli.cli_dev import PACKAGE_ROOT, app
6
+ from mposcli.shared_tyro import TyroVerbosityArgType
7
7
 
8
8
 
9
9
  @app.command
@@ -4,10 +4,10 @@ from pathlib import Path
4
4
 
5
5
  from cli_base.cli_tools import git_history
6
6
  from cli_base.cli_tools.verbosity import setup_logging
7
- from cli_base.tyro_commands import TyroVerbosityArgType
8
7
  from rich import print
9
8
 
10
9
  from mposcli.cli_dev import app
10
+ from mposcli.shared_tyro import TyroVerbosityArgType
11
11
 
12
12
 
13
13
  logger = logging.getLogger(__name__)
@@ -22,5 +22,5 @@ def list_executables(directory: Path) -> list[Path]:
22
22
  if os.access(entry, os.X_OK):
23
23
  executables.append(entry)
24
24
  else:
25
- logger.info('Skipping non-executable file: %s', entry)
25
+ logger.warning('%s is not executable! (Hint: "chmod +x <filename>")', entry)
26
26
  return executables
@@ -0,0 +1,17 @@
1
+ from typing import Annotated
2
+
3
+ import tyro
4
+ from tyro.conf import UseCounterAction
5
+
6
+
7
+ DEFAULT_VERBOSITY = 1 # Display warnings by default
8
+
9
+ # https://brentyi.github.io/tyro/examples/04_additional/12_counters/
10
+ TyroVerbosityArgType = Annotated[
11
+ UseCounterAction[int],
12
+ tyro.conf.arg(
13
+ aliases=['-v'],
14
+ help='Verbosity level; e.g.: -v, -vv, -vvv, etc.',
15
+ default=DEFAULT_VERBOSITY,
16
+ ),
17
+ ]
@@ -47,14 +47,14 @@ class ProjectSetupTestCase(TestCase):
47
47
  resolver.resolve(mpos_path / 'internal_filesystem/lib/mpos/board/'),
48
48
  (
49
49
  'internal_filesystem/lib/mpos/board/',
50
- ':mpos/',
50
+ ':lib/mpos/',
51
51
  ),
52
52
  )
53
53
  self.assertEqual(
54
54
  resolver.resolve(mpos_path / 'internal_filesystem/lib/mpos/board/unphone.py'),
55
55
  (
56
56
  'internal_filesystem/lib/mpos/board/unphone.py',
57
- ':mpos/board/unphone.py',
57
+ ':lib/mpos/board/unphone.py',
58
58
  ),
59
59
  )
60
60
 
File without changes
@@ -3,7 +3,6 @@ import subprocess
3
3
  import time
4
4
  from pathlib import Path
5
5
 
6
- from bx_py_utils.path import assert_is_dir
7
6
  from rich import print
8
7
 
9
8
  from mposcli.tools import get_mpremote_bin
@@ -13,24 +12,14 @@ class MpOsPathResolver:
13
12
  def __init__(self, mpos: Path):
14
13
  self.mpos = mpos # e.g.: ~/repos/MicroPythonOS
15
14
  self.internal_fs = mpos / 'internal_filesystem'
16
- self.lib_mpos = self.internal_fs / 'lib' / 'mpos'
17
- assert_is_dir(self.lib_mpos)
18
- self.apps_path = self.internal_fs / 'apps'
19
- assert_is_dir(self.apps_path)
20
15
 
21
16
  def resolve(self, source: Path):
22
17
  source = source.resolve()
23
18
  assert source.exists(), f'Not existing path: {source=}'
24
19
  assert source.is_relative_to(self.mpos), f'{source=} is not inside {self.mpos=}'
20
+ assert source.is_relative_to(self.internal_fs), f'{source=} is not inside {self.internal_fs=}'
25
21
 
26
- if source.is_relative_to(self.apps_path):
27
- device_base_path = self.apps_path.parent
28
- elif source.is_relative_to(self.lib_mpos):
29
- device_base_path = self.lib_mpos.parent
30
- elif source.is_relative_to(self.internal_fs):
31
- device_base_path = self.internal_fs
32
- else:
33
- raise ValueError(f'Path {source} is not in a recognized location')
22
+ device_base_path = self.internal_fs
34
23
 
35
24
  remote_path = source.relative_to(device_base_path)
36
25
  source_path = source.relative_to(self.mpos)