micropython-stubber 1.20.0__tar.gz → 1.20.1__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 (153) hide show
  1. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/PKG-INFO +4 -4
  2. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/pyproject.toml +7 -7
  3. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/README.md +41 -33
  4. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/libusb_flash.ipynb +203 -203
  5. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/ask_input.py +18 -3
  6. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/cli_download.py +16 -12
  7. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/cli_flash.py +7 -3
  8. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/cli_list.py +2 -2
  9. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/cli_main.py +4 -3
  10. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/download.py +11 -8
  11. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/list.py +2 -1
  12. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpboard_id/board_id.py +14 -11
  13. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpremoteboard/runner.py +12 -12
  14. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/poetry.lock +1 -1
  15. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/pyproject.toml +2 -2
  16. micropython_stubber-1.20.1/src/stubber/__init__.py +3 -0
  17. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs.py +3 -3
  18. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs_db.py +4 -4
  19. micropython_stubber-1.20.1/src/stubber/board/createstubs_db_min.py +828 -0
  20. micropython_stubber-1.20.1/src/stubber/board/createstubs_db_mpy.mpy +0 -0
  21. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs_mem.py +4 -4
  22. micropython_stubber-1.20.1/src/stubber/board/createstubs_mem_min.py +768 -0
  23. micropython_stubber-1.20.1/src/stubber/board/createstubs_mem_mpy.mpy +0 -0
  24. micropython_stubber-1.20.1/src/stubber/board/createstubs_min.py +977 -0
  25. micropython_stubber-1.20.1/src/stubber/board/createstubs_mpy.mpy +0 -0
  26. micropython_stubber-1.20.0/src/stubber/__init__.py +0 -3
  27. micropython_stubber-1.20.0/src/stubber/board/createstubs_db_min.py +0 -332
  28. micropython_stubber-1.20.0/src/stubber/board/createstubs_db_mpy.mpy +0 -0
  29. micropython_stubber-1.20.0/src/stubber/board/createstubs_mem_min.py +0 -307
  30. micropython_stubber-1.20.0/src/stubber/board/createstubs_mem_mpy.mpy +0 -0
  31. micropython_stubber-1.20.0/src/stubber/board/createstubs_min.py +0 -295
  32. micropython_stubber-1.20.0/src/stubber/board/createstubs_mpy.mpy +0 -0
  33. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/LICENSE +0 -0
  34. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/readme.md +0 -0
  35. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/__init__.py +0 -0
  36. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/cli_group.py +0 -0
  37. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/common.py +0 -0
  38. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/config.py +0 -0
  39. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/downloaded.py +0 -0
  40. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/errors.py +0 -0
  41. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash.py +0 -0
  42. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_esp.py +0 -0
  43. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_stm32.py +0 -0
  44. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_stm32_cube.py +0 -0
  45. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_stm32_dfu.py +0 -0
  46. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_uf2.py +0 -0
  47. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_uf2_boardid.py +0 -0
  48. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_uf2_linux.py +0 -0
  49. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/flash_uf2_windows.py +0 -0
  50. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/logger.py +0 -0
  51. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpboard_id/__init__.py +0 -0
  52. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpboard_id/board_info.csv +0 -0
  53. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpboard_id/board_info.json +0 -0
  54. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpremoteboard/__init__.py +0 -0
  55. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -0
  56. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/vendor/dfu.py +0 -0
  57. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/vendor/pydfu.py +0 -0
  58. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/vendor/readme.md +0 -0
  59. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/vendor/versions.py +0 -0
  60. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/mpflash/worklist.py +0 -0
  61. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/mpflash/stm32_udev_rules.md +0 -0
  62. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/basicgit.py +0 -0
  63. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/board_info.csv +0 -0
  64. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/boot.py +0 -0
  65. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs_lvgl.py +0 -0
  66. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs_lvgl_min.py +0 -0
  67. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/createstubs_lvgl_mpy.mpy +0 -0
  68. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/fw_info.py +0 -0
  69. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/info.py +0 -0
  70. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/main.py +0 -0
  71. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/modulelist.txt +0 -0
  72. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/board/pyrightconfig.json +0 -0
  73. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/bulk/mcu_stubber.py +0 -0
  74. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/__init__.py +0 -0
  75. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/_partials/__init__.py +0 -0
  76. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/_partials/db_main.py +0 -0
  77. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/_partials/lvgl_main.py +0 -0
  78. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/_partials/modules_reader.py +0 -0
  79. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/add_comment.py +0 -0
  80. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/add_method.py +0 -0
  81. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/board.py +0 -0
  82. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/enrich.py +0 -0
  83. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/merge_docstub.py +0 -0
  84. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/modify_list.py +0 -0
  85. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/codemod/utils.py +0 -0
  86. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/__init__.py +0 -0
  87. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/build_cmd.py +0 -0
  88. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/cli.py +0 -0
  89. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/clone_cmd.py +0 -0
  90. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/config_cmd.py +0 -0
  91. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/enrich_folder_cmd.py +0 -0
  92. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/get_core_cmd.py +0 -0
  93. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/get_docstubs_cmd.py +0 -0
  94. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/get_frozen_cmd.py +0 -0
  95. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/get_mcu_cmd.py +0 -0
  96. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/merge_cmd.py +0 -0
  97. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/publish_cmd.py +0 -0
  98. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/stub_cmd.py +0 -0
  99. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/switch_cmd.py +0 -0
  100. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/commands/variants_cmd.py +0 -0
  101. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/cst_transformer.py +0 -0
  102. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/data/board_info.csv +0 -0
  103. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/data/board_info.json +0 -0
  104. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/data/micropython_tags.csv +0 -0
  105. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/data/requirements-core-micropython.txt +0 -0
  106. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/data/requirements-core-pycopy.txt +0 -0
  107. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/downloader.py +0 -0
  108. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/freeze/__init__.py +0 -0
  109. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/freeze/common.py +0 -0
  110. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/freeze/freeze_folder.py +0 -0
  111. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/freeze/freeze_manifest_2.py +0 -0
  112. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/freeze/get_frozen.py +0 -0
  113. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/get_cpython.py +0 -0
  114. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/get_lobo.py +0 -0
  115. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/minify.py +0 -0
  116. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/__init__.py +0 -0
  117. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/bump.py +0 -0
  118. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/candidates.py +0 -0
  119. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/database.py +0 -0
  120. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/defaults.py +0 -0
  121. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/enums.py +0 -0
  122. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/helpers.py +0 -0
  123. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/merge_docstubs.py +0 -0
  124. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/missing_class_methods.py +0 -0
  125. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/package.py +0 -0
  126. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/pathnames.py +0 -0
  127. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/publish.py +0 -0
  128. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/pypi.py +0 -0
  129. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/publish/stubpackage.py +0 -0
  130. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/__init__.py +0 -0
  131. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/classsort.py +0 -0
  132. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/lookup.py +0 -0
  133. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/output_dict.py +0 -0
  134. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/reader.py +0 -0
  135. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/report_return.py +0 -0
  136. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/rst/rst_utils.py +0 -0
  137. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/stubber.py +0 -0
  138. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/stubs_from_docs.py +0 -0
  139. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/tools/__init__.py +0 -0
  140. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/tools/manifestfile.py +0 -0
  141. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/tools/readme.md +0 -0
  142. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/update_fallback.py +0 -0
  143. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/update_module_list.py +0 -0
  144. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/__init__.py +0 -0
  145. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/config.py +0 -0
  146. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/makeversionhdr.py +0 -0
  147. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/manifest.py +0 -0
  148. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/post.py +0 -0
  149. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/repos.py +0 -0
  150. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/stubmaker.py +0 -0
  151. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/typed_config_toml.py +0 -0
  152. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/utils/versions.py +0 -0
  153. {micropython_stubber-1.20.0 → micropython_stubber-1.20.1}/src/stubber/variants.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micropython-stubber
3
- Version: 1.20.0
3
+ Version: 1.20.1
4
4
  Summary: Tooling to create and maintain stubs for MicroPython
5
5
  Home-page: https://github.com/Josverl/micropython-stubber#readme
6
6
  License: MIT
@@ -18,16 +18,16 @@ Classifier: Programming Language :: Python :: Implementation :: MicroPython
18
18
  Classifier: Topic :: Software Development :: Build Tools
19
19
  Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
20
20
  Requires-Dist: autoflake (>=1.7,<3.0)
21
- Requires-Dist: black (>=22.10,<23.0)
21
+ Requires-Dist: black (>=22.10,<25.0)
22
22
  Requires-Dist: cachetools (>=5.3.0,<6.0.0)
23
23
  Requires-Dist: click (>=8.1.3,<9.0.0)
24
24
  Requires-Dist: executing (>=2.0.1,<3.0.0)
25
25
  Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
26
26
  Requires-Dist: libcst (>=1.1.0,<2.0.0)
27
27
  Requires-Dist: loguru (>=0.6,<0.8)
28
- Requires-Dist: mpflash (>=0.6.0)
28
+ Requires-Dist: mpflash (>=0.7.4,<0.8.0)
29
29
  Requires-Dist: mpremote (>=1.22.0,<2.0.0)
30
- Requires-Dist: mypy (==1.7.0)
30
+ Requires-Dist: mypy (==1.9.0)
31
31
  Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
32
32
  Requires-Dist: packaging (>=21.3,<24.0)
33
33
  Requires-Dist: pipx (>=1.1.0,<2.0.0)
@@ -8,7 +8,7 @@ repo-path = "./repos"
8
8
 
9
9
  [tool.poetry]
10
10
  name = "micropython-stubber"
11
- version = "1.20.0"
11
+ version = "1.20.1"
12
12
  description = "Tooling to create and maintain stubs for MicroPython"
13
13
  authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
14
14
  license = "MIT"
@@ -46,18 +46,20 @@ stubber = "stubber.stubber:stubber_cli"
46
46
 
47
47
  [tool.poetry.dependencies]
48
48
  python = ">=3.9,<4.0"
49
- mpflash = ">=0.6.0"
49
+ python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet
50
+ requests = "^2.28.0"
51
+ mypy = "1.9.0"
52
+ mpflash = "^0.7.4"
50
53
  mpremote = "^1.22.0"
51
54
  # others
52
55
  autoflake = ">=1.7,<3.0"
53
- black = ">=22.10,<23.0"
56
+ black = ">=22.10,<25.0"
57
+ libcst = "^1.1.0"
54
58
  cachetools = "^5.3.0"
55
59
  click = "^8.1.3"
56
60
  executing = "^2.0.1"
57
61
  importlib-metadata = { version = "^1.0", python = "<3.8" }
58
- libcst = "^1.1.0"
59
62
  loguru = ">=0.6,<0.8"
60
- mypy = "1.7.0"
61
63
  mypy-gitlab-code-quality = "^1.1.0"
62
64
  packaging = ">=21.3,<24.0"
63
65
  pipx = "^1.1.0"
@@ -66,8 +68,6 @@ pyright = "^1.1.341"
66
68
  pyserial = "^3.5"
67
69
  pysondb-v2 = "^2.1.0"
68
70
  pypi-simple = "^1.0.0"
69
- python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet
70
- requests = "^2.28.0"
71
71
  rich-click = "^1.7.3"
72
72
  tabulate = "^0.9.0"
73
73
  tenacity = "^8.2.2"
@@ -1,15 +1,16 @@
1
- # mpflash
2
- mpflash is a command-line tool for working with MicroPython firmware. It provides various features to help you develop, build, and manage your MicroPython projects.
1
+ # MPFLASH
3
2
 
4
- This tool was created to be used in a CI/CD pipeline to automate the process of downloading and flashing MicroPython firmware to multiple boards, but it can also be used for manual flashing and development.
3
+ `mpflash` is a command-line tool for working with MicroPython firmware. It provides features to help you flash and update Micropython on one or more .
5
4
 
6
- mpflash has been tested on Windows x64, Linux X64 and ARM64, but not (yet) macOS.
5
+ This tool was initially created to be used in a CI/CD pipeline to automate the process of downloading and flashing MicroPython firmware to multiple boards, but it has been extend with a TUI to me be used for manual downloadig, flashing and development.
6
+
7
+ `mpflash` has been tested on Windows x64, Linux X64, but not (yet) macOS.
8
+ Tested ports: `rp2`, `samd`, `esp32`, `esp32s3`, `esp32c3`, `esp8266` and `stm32`
7
9
 
8
10
  ## Features
9
11
  1. List the connected boards including their firmware details, in a tabular or json format
10
- 2. Download MicroPython firmware for specific boards and versions.
11
- 3. Flash one or all connected MicroPython boards with a specific firmware or version.
12
- Tested ports: rp2, samd, esp32, esp32s3, esp8266 and stm32
12
+ 2. Download MicroPython firmware for versions, and matching a specified board or matches your current attached board.
13
+ 3. Flash one or all connected MicroPython boards with a specific firmware or version.
13
14
 
14
15
  ## Installation
15
16
  To install mpflash, you can use pip: `pip install mpflash`
@@ -30,40 +31,40 @@ On Windows this will not be an issue, but on Linux you can use udev rules to gi
30
31
  [See the stm32_permissions documentation](./stm32_udev_rules.md) for more information.
31
32
 
32
33
 
33
- ## Advanced use
34
+ ## Detailed usage
34
35
  You can list the connected boards using the following command:
35
36
  ```bash
36
37
  $ mpflash list
37
38
  D:\MyPython\micropython-stubber> mpflash list
38
- Getting board info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:02
39
- Connected boards
40
- ┏━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━┓
41
- ┃ Serial ┃ Family ┃ Port ┃ Board ┃ CPU ┃ Version ┃ build ┃
42
- ┡━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━┩
43
- COM11 micropython rp2 │ RPI_PICO_W │ RP2040 1.20.0
44
- COM12 micropython esp8266 ESP8266_GENERIC ESP8266 1.22.2
45
- COM18 micropython rp2 │ RPI_PICO_W │ RP2040 1.23.0-preview 155
46
- COM3 micropython samd SEEED_WIO_TERMINAL SAMD51P19A 1.23.0-preview 155
47
- COM5 micropython stm32 PYBV11 │ STM32F405RG 1.23.0-preview 166
48
- │ COM8 │ micropython │ esp32 │ ESP32_GENERIC_S3 │ ESP32S3 │ 1.23.0-preview │ 155 │
49
- └────────┴─────────────┴─────────┴────────────────────┴─────────────┴────────────────┴───────┘
39
+ Connected boards
40
+ ┏━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━┓
41
+ ┃ Serial ┃Family ┃Port ┃Board ┃CPU ┃Version ┃build ┃
42
+ ┡━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━┩
43
+ │ COM21 │micropython │rp2 │RPI_PICO │RP2040 │v1.23.0-preview │ 236 │
44
+ │ │Raspberry Pi Pico with RP2040
45
+ COM23 │micropython rp2 RPI_PICO_W RP2040 v1.23.0-preview 176
46
+ │ │Raspberry Pi Pico W with RP2040
47
+ COM9 │micropython rp2 ARDUINO_NANO_RP2040_CONNECT RP2040v1.23.0-preview 341
48
+ Arduino Nano RP2040 Connect with RP2040 │ │
49
+ └─────────┴─────────────┴──────┴───────────────────────────────────────────┴────────┴─────────────────┴──────┘
50
50
  ```
51
+ ## Download the firmware
51
52
 
52
- Suppose you want to download the MicroPython firmware for some boards, you can use the following command:
53
+ To download the MicroPython firmware for some boards, use the following command:
54
+ - `mpflash download` download the latest stable firmware for all connected boards
55
+ - `mpflash download --version preview` download the current preview for all connected boards
56
+ - `mpflash download --board ESP8266_GENERIC --board SEEED_WIO_TERMINAL` download these specific boards
57
+ - `mpflash download --version ? --board ?` prompt to select a specific version and board to download
53
58
 
54
- ```bash
55
- # download the firmware
56
- $ mpflash download --board ESP8266_GENERIC --board SEEED_WIO_TERMINAL
57
- ```
58
- This will download the latest stable version of the MicroPython firmware for the boards and save it in the `firmware` directory.
59
+ These will try to download the prebuilt MicroPython firmware for the boards from https://micropython.org/download/ and save it in your downloads folder in the `firmware` directory.
59
60
  The stable version (default) is determined based on the most recent published release,
60
- other optionse are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively.
61
+ other versions are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively.
61
62
 
62
- by default the firmware will be downloaded to Downloads in a `firmware` folder in your, but you can specify a different directory using the `--dir` option.
63
+ By default the firmware will be downloaded to your OS's preferred `Downloads/firmware` folder, but you can speciy a different directory using the `--dir` option.
63
64
 
64
- ```bash
65
65
  The directory structure will be something like this:
66
- ```
66
+
67
+ ``` text
67
68
  Downloads/firmware
68
69
  | firmware.jsonl
69
70
  +---esp8266
@@ -74,9 +75,16 @@ Downloads/firmware
74
75
  \---samd
75
76
  SEEED_WIO_TERMINAL-v1.22.2.uf2
76
77
  ```
77
- You can then flash the firmware to the board using the following command: `mpflash flash`
78
+
79
+ ## Flashing the firmware
80
+ After you have downloaded a firmware you can flash the firmware to a board using the following command: `mpflash flash`
78
81
  This will (try to) autodetect the connected boards, and determine the correct firmware to flash to each board.
79
82
 
83
+ - `mpflash flash` will flash the latest stable firmware to all connected boards.
84
+ - `mpflash flash --serial ? --board ?` will prompt to select a specific serial port and board to flash. (the firmware must be dowloaded earlier)
85
+
86
+
87
+ ### Flashing all connected boards with the latest stable firmware
80
88
  ```bash
81
89
  > mpflash flash
82
90
  22:15:55 | ℹ️ - Using latest stable version: v1.22.2
@@ -158,8 +166,8 @@ Note that if no matching firmware can be found for a board, it will be skipped.
158
166
  (For example, the PYBV11 and ESP32_GENERIC_S3 boards in the example above.)
159
167
 
160
168
  ## Issues and bug reports
161
- mpflash is currently co-located in the [micropython-stubber](https://github.com/Josverl/micropython-stubber) repository.
162
- Please report any issues or bugs in the [issue tracker](https://github.com/Josverl/micropython-stubber/issues) with '[mpflash]' in the subject.
169
+ mpflash is currently co-located in the [micropython-stubber](https://github.com/Josverl/micropython-stubber) repository.
170
+ Please report any issues or bugs in the [issue tracker](https://github.com/Josverl/micropython-stubber/issues) using the MPflash feedback template.
163
171
 
164
172
  ## License
165
173
  mpflash is licensed under the MIT license. See the LICENSE file for more details.
@@ -1,203 +1,203 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 3,
6
- "metadata": {},
7
- "outputs": [
8
- {
9
- "data": {
10
- "text/plain": [
11
- "[<DEVICE ID 0a05:7211 on Bus 002 Address 054>,\n",
12
- " <DEVICE ID 0a05:7211 on Bus 002 Address 032>,\n",
13
- " <DEVICE ID 045e:0c1e on Bus 002 Address 002>,\n",
14
- " <DEVICE ID 045e:07b2 on Bus 002 Address 028>,\n",
15
- " <DEVICE ID 045e:0904 on Bus 002 Address 015>,\n",
16
- " <DEVICE ID 043e:9a39 on Bus 002 Address 057>,\n",
17
- " <DEVICE ID 045e:0901 on Bus 002 Address 006>,\n",
18
- " <DEVICE ID 05e3:0610 on Bus 002 Address 010>,\n",
19
- " <DEVICE ID 2109:0817 on Bus 001 Address 001>,\n",
20
- " <DEVICE ID 045e:0902 on Bus 002 Address 008>,\n",
21
- " <DEVICE ID 1000:2000 on Bus 002 Address 016>,\n",
22
- " <DEVICE ID 1189:8890 on Bus 002 Address 027>,\n",
23
- " <DEVICE ID 2109:0817 on Bus 001 Address 002>,\n",
24
- " <DEVICE ID 2109:2812 on Bus 002 Address 025>,\n",
25
- " <DEVICE ID 046d:085e on Bus 002 Address 017>,\n",
26
- " <DEVICE ID 045e:07c6 on Bus 002 Address 056>,\n",
27
- " <DEVICE ID 0bda:5401 on Bus 002 Address 009>,\n",
28
- " <DEVICE ID 10c4:ea60 on Bus 002 Address 055>,\n",
29
- " <DEVICE ID 2109:2817 on Bus 002 Address 004>,\n",
30
- " <DEVICE ID 0bda:5411 on Bus 002 Address 005>,\n",
31
- " <DEVICE ID 045e:0900 on Bus 002 Address 003>,\n",
32
- " <DEVICE ID 04e8:61f5 on Bus 002 Address 023>,\n",
33
- " <DEVICE ID 045e:0903 on Bus 002 Address 020>,\n",
34
- " <DEVICE ID 2109:2812 on Bus 002 Address 026>,\n",
35
- " <DEVICE ID 8086:a0ed on Bus 002 Address 000>,\n",
36
- " <DEVICE ID 2109:2817 on Bus 002 Address 013>,\n",
37
- " <DEVICE ID 8087:0029 on Bus 002 Address 001>,\n",
38
- " <DEVICE ID 8086:9a13 on Bus 001 Address 000>]"
39
- ]
40
- },
41
- "execution_count": 3,
42
- "metadata": {},
43
- "output_type": "execute_result"
44
- }
45
- ],
46
- "source": [
47
- "import usb.core\n",
48
- "import usb.util\n",
49
- "import usb.backend.libusb1 as libusb1\n",
50
- "from usb.core import USBError, Device\n",
51
- "\n",
52
- "from pathlib import Path\n",
53
- "import platform\n",
54
- "\n",
55
- "if platform.system() == \"Windows\":\n",
56
- " # on windows you need to use the libusb1 backend\n",
57
- " import libusb\n",
58
- "\n",
59
- " arch = \"x64\" if platform.architecture()[0] == \"64bit\" else \"x86\"\n",
60
- " libusb1_dll = Path(libusb.__file__).parent / f\"_platform\\\\_windows\\\\{arch}\\\\libusb-1.0.dll\"\n",
61
- "\n",
62
- " backend = libusb1.get_backend(find_library=lambda x: libusb1_dll.as_posix())\n",
63
- "usb_devices = usb.core.find(backend=backend, find_all=True)\n",
64
- "\n",
65
- "list(usb_devices)"
66
- ]
67
- },
68
- {
69
- "cell_type": "code",
70
- "execution_count": null,
71
- "metadata": {},
72
- "outputs": [],
73
- "source": [
74
- "for d in usb.core.find(backend=backend, find_all=True):\n",
75
- " print(f\"Device {d.idVendor:04x}:{d.idProduct:04x}\")\n",
76
- " print(f\"{d.iManufacturer=}\")\n",
77
- " print(f\"{d.iProduct=}\")\n",
78
- " print(f\"{d.bDeviceClass=}\")\n",
79
- " print(f\"{d.bDescriptorType=}\")\n",
80
- " print(f\"{d.bcdDevice=}\")\n",
81
- " print(f\"{d.bcdUSB=}\")\n",
82
- " # print(dir(d))\n",
83
- " # print(f\" Manufacturer: {usb.util.get_string(dev, dev.iManufacturer)}\")\n",
84
- "\n",
85
- " print()"
86
- ]
87
- },
88
- {
89
- "cell_type": "code",
90
- "execution_count": null,
91
- "metadata": {},
92
- "outputs": [],
93
- "source": [
94
- "import serial.tools.list_ports\n",
95
- "\n",
96
- "ports = serial.tools.list_ports.comports()\n",
97
- "\n",
98
- "for port in ports:\n",
99
- " print(f\"Port: {port.device}\")\n",
100
- " print(f\"Description: {port.description}\")\n",
101
- " print(f\"Hardware ID: {port.hwid}\")\n",
102
- " print()"
103
- ]
104
- },
105
- {
106
- "cell_type": "code",
107
- "execution_count": null,
108
- "metadata": {},
109
- "outputs": [],
110
- "source": [
111
- "from mpflash.vendor import pydfu as pydfu\n",
112
- "\n",
113
- "try:\n",
114
- " pydfu.list_dfu_devices()\n",
115
- "except SystemExit:\n",
116
- " print(\"No DFU devices found\")"
117
- ]
118
- },
119
- {
120
- "cell_type": "code",
121
- "execution_count": null,
122
- "metadata": {},
123
- "outputs": [],
124
- "source": [
125
- "pydfu.init()"
126
- ]
127
- },
128
- {
129
- "cell_type": "code",
130
- "execution_count": null,
131
- "metadata": {},
132
- "outputs": [],
133
- "source": [
134
- "dfu_file = Path(\"C:\\\\Users\\\\josverl\\\\Downloads\\\\firmware\\\\stm32\\\\PYBV11-THREAD-v1.23.0-preview.203.dfu\")\n",
135
- "\n",
136
- "print(\"Read DFU file...\")\n",
137
- "elements = pydfu.read_dfu_file(dfu_file)\n",
138
- "if not elements:\n",
139
- " print(\"No data in dfu file\")"
140
- ]
141
- },
142
- {
143
- "cell_type": "code",
144
- "execution_count": 1,
145
- "metadata": {},
146
- "outputs": [
147
- {
148
- "name": "stdout",
149
- "output_type": "stream",
150
- "text": [
151
- "Writing memory...\n"
152
- ]
153
- },
154
- {
155
- "ename": "NameError",
156
- "evalue": "name 'pydfu' is not defined",
157
- "output_type": "error",
158
- "traceback": [
159
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
160
- "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
161
- "Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWriting memory...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m \u001b[43mpydfu\u001b[49m\u001b[38;5;241m.\u001b[39mwrite_elements(elements, \u001b[38;5;28;01mFalse\u001b[39;00m, progress\u001b[38;5;241m=\u001b[39mpydfu\u001b[38;5;241m.\u001b[39mcli_progress)\n",
162
- "\u001b[1;31mNameError\u001b[0m: name 'pydfu' is not defined"
163
- ]
164
- }
165
- ],
166
- "source": [
167
- "print(\"Writing memory...\")\n",
168
- "pydfu.write_elements(elements, False, progress=pydfu.cli_progress)"
169
- ]
170
- },
171
- {
172
- "cell_type": "code",
173
- "execution_count": null,
174
- "metadata": {},
175
- "outputs": [],
176
- "source": [
177
- "print(\"Exiting DFU...\")\n",
178
- "pydfu.exit_dfu()"
179
- ]
180
- }
181
- ],
182
- "metadata": {
183
- "kernelspec": {
184
- "display_name": ".venv",
185
- "language": "python",
186
- "name": "python3"
187
- },
188
- "language_info": {
189
- "codemirror_mode": {
190
- "name": "ipython",
191
- "version": 3
192
- },
193
- "file_extension": ".py",
194
- "mimetype": "text/x-python",
195
- "name": "python",
196
- "nbconvert_exporter": "python",
197
- "pygments_lexer": "ipython3",
198
- "version": "3.11.7"
199
- }
200
- },
201
- "nbformat": 4,
202
- "nbformat_minor": 2
203
- }
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 3,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "text/plain": [
11
+ "[<DEVICE ID 0a05:7211 on Bus 002 Address 054>,\n",
12
+ " <DEVICE ID 0a05:7211 on Bus 002 Address 032>,\n",
13
+ " <DEVICE ID 045e:0c1e on Bus 002 Address 002>,\n",
14
+ " <DEVICE ID 045e:07b2 on Bus 002 Address 028>,\n",
15
+ " <DEVICE ID 045e:0904 on Bus 002 Address 015>,\n",
16
+ " <DEVICE ID 043e:9a39 on Bus 002 Address 057>,\n",
17
+ " <DEVICE ID 045e:0901 on Bus 002 Address 006>,\n",
18
+ " <DEVICE ID 05e3:0610 on Bus 002 Address 010>,\n",
19
+ " <DEVICE ID 2109:0817 on Bus 001 Address 001>,\n",
20
+ " <DEVICE ID 045e:0902 on Bus 002 Address 008>,\n",
21
+ " <DEVICE ID 1000:2000 on Bus 002 Address 016>,\n",
22
+ " <DEVICE ID 1189:8890 on Bus 002 Address 027>,\n",
23
+ " <DEVICE ID 2109:0817 on Bus 001 Address 002>,\n",
24
+ " <DEVICE ID 2109:2812 on Bus 002 Address 025>,\n",
25
+ " <DEVICE ID 046d:085e on Bus 002 Address 017>,\n",
26
+ " <DEVICE ID 045e:07c6 on Bus 002 Address 056>,\n",
27
+ " <DEVICE ID 0bda:5401 on Bus 002 Address 009>,\n",
28
+ " <DEVICE ID 10c4:ea60 on Bus 002 Address 055>,\n",
29
+ " <DEVICE ID 2109:2817 on Bus 002 Address 004>,\n",
30
+ " <DEVICE ID 0bda:5411 on Bus 002 Address 005>,\n",
31
+ " <DEVICE ID 045e:0900 on Bus 002 Address 003>,\n",
32
+ " <DEVICE ID 04e8:61f5 on Bus 002 Address 023>,\n",
33
+ " <DEVICE ID 045e:0903 on Bus 002 Address 020>,\n",
34
+ " <DEVICE ID 2109:2812 on Bus 002 Address 026>,\n",
35
+ " <DEVICE ID 8086:a0ed on Bus 002 Address 000>,\n",
36
+ " <DEVICE ID 2109:2817 on Bus 002 Address 013>,\n",
37
+ " <DEVICE ID 8087:0029 on Bus 002 Address 001>,\n",
38
+ " <DEVICE ID 8086:9a13 on Bus 001 Address 000>]"
39
+ ]
40
+ },
41
+ "execution_count": 3,
42
+ "metadata": {},
43
+ "output_type": "execute_result"
44
+ }
45
+ ],
46
+ "source": [
47
+ "import usb.core\n",
48
+ "import usb.util\n",
49
+ "import usb.backend.libusb1 as libusb1\n",
50
+ "from usb.core import USBError, Device\n",
51
+ "\n",
52
+ "from pathlib import Path\n",
53
+ "import platform\n",
54
+ "\n",
55
+ "if platform.system() == \"Windows\":\n",
56
+ " # on windows you need to use the libusb1 backend\n",
57
+ " import libusb\n",
58
+ "\n",
59
+ " arch = \"x64\" if platform.architecture()[0] == \"64bit\" else \"x86\"\n",
60
+ " libusb1_dll = Path(libusb.__file__).parent / f\"_platform\\\\_windows\\\\{arch}\\\\libusb-1.0.dll\"\n",
61
+ "\n",
62
+ " backend = libusb1.get_backend(find_library=lambda x: libusb1_dll.as_posix())\n",
63
+ "usb_devices = usb.core.find(backend=backend, find_all=True)\n",
64
+ "\n",
65
+ "list(usb_devices)"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": null,
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "for d in usb.core.find(backend=backend, find_all=True):\n",
75
+ " print(f\"Device {d.idVendor:04x}:{d.idProduct:04x}\")\n",
76
+ " print(f\"{d.iManufacturer=}\")\n",
77
+ " print(f\"{d.iProduct=}\")\n",
78
+ " print(f\"{d.bDeviceClass=}\")\n",
79
+ " print(f\"{d.bDescriptorType=}\")\n",
80
+ " print(f\"{d.bcdDevice=}\")\n",
81
+ " print(f\"{d.bcdUSB=}\")\n",
82
+ " # print(dir(d))\n",
83
+ " # print(f\" Manufacturer: {usb.util.get_string(dev, dev.iManufacturer)}\")\n",
84
+ "\n",
85
+ " print()"
86
+ ]
87
+ },
88
+ {
89
+ "cell_type": "code",
90
+ "execution_count": null,
91
+ "metadata": {},
92
+ "outputs": [],
93
+ "source": [
94
+ "import serial.tools.list_ports\n",
95
+ "\n",
96
+ "ports = serial.tools.list_ports.comports()\n",
97
+ "\n",
98
+ "for port in ports:\n",
99
+ " print(f\"Port: {port.device}\")\n",
100
+ " print(f\"Description: {port.description}\")\n",
101
+ " print(f\"Hardware ID: {port.hwid}\")\n",
102
+ " print()"
103
+ ]
104
+ },
105
+ {
106
+ "cell_type": "code",
107
+ "execution_count": null,
108
+ "metadata": {},
109
+ "outputs": [],
110
+ "source": [
111
+ "from mpflash.vendor import pydfu as pydfu\n",
112
+ "\n",
113
+ "try:\n",
114
+ " pydfu.list_dfu_devices()\n",
115
+ "except SystemExit:\n",
116
+ " print(\"No DFU devices found\")"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": null,
122
+ "metadata": {},
123
+ "outputs": [],
124
+ "source": [
125
+ "pydfu.init()"
126
+ ]
127
+ },
128
+ {
129
+ "cell_type": "code",
130
+ "execution_count": null,
131
+ "metadata": {},
132
+ "outputs": [],
133
+ "source": [
134
+ "dfu_file = Path(\"C:\\\\Users\\\\josverl\\\\Downloads\\\\firmware\\\\stm32\\\\PYBV11-THREAD-v1.23.0-preview.203.dfu\")\n",
135
+ "\n",
136
+ "print(\"Read DFU file...\")\n",
137
+ "elements = pydfu.read_dfu_file(dfu_file)\n",
138
+ "if not elements:\n",
139
+ " print(\"No data in dfu file\")"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": 1,
145
+ "metadata": {},
146
+ "outputs": [
147
+ {
148
+ "name": "stdout",
149
+ "output_type": "stream",
150
+ "text": [
151
+ "Writing memory...\n"
152
+ ]
153
+ },
154
+ {
155
+ "ename": "NameError",
156
+ "evalue": "name 'pydfu' is not defined",
157
+ "output_type": "error",
158
+ "traceback": [
159
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
160
+ "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
161
+ "Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWriting memory...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m \u001b[43mpydfu\u001b[49m\u001b[38;5;241m.\u001b[39mwrite_elements(elements, \u001b[38;5;28;01mFalse\u001b[39;00m, progress\u001b[38;5;241m=\u001b[39mpydfu\u001b[38;5;241m.\u001b[39mcli_progress)\n",
162
+ "\u001b[1;31mNameError\u001b[0m: name 'pydfu' is not defined"
163
+ ]
164
+ }
165
+ ],
166
+ "source": [
167
+ "print(\"Writing memory...\")\n",
168
+ "pydfu.write_elements(elements, False, progress=pydfu.cli_progress)"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": null,
174
+ "metadata": {},
175
+ "outputs": [],
176
+ "source": [
177
+ "print(\"Exiting DFU...\")\n",
178
+ "pydfu.exit_dfu()"
179
+ ]
180
+ }
181
+ ],
182
+ "metadata": {
183
+ "kernelspec": {
184
+ "display_name": ".venv",
185
+ "language": "python",
186
+ "name": "python3"
187
+ },
188
+ "language_info": {
189
+ "codemirror_mode": {
190
+ "name": "ipython",
191
+ "version": 3
192
+ },
193
+ "file_extension": ".py",
194
+ "mimetype": "text/x-python",
195
+ "name": "python",
196
+ "nbconvert_exporter": "python",
197
+ "pygments_lexer": "ipython3",
198
+ "version": "3.11.7"
199
+ }
200
+ },
201
+ "nbformat": 4,
202
+ "nbformat_minor": 2
203
+ }
@@ -12,7 +12,7 @@ from typing import Dict, List, Sequence, Tuple, Union
12
12
  from loguru import logger as log
13
13
 
14
14
  from mpflash.config import config
15
- from mpflash.mpboard_id import known_stored_boards, local_mp_ports
15
+ from mpflash.mpboard_id import get_stored_boards_for_port, known_stored_boards, local_mp_ports
16
16
  from mpflash.mpremoteboard import MPRemoteBoard
17
17
  from mpflash.vendor.versions import micropython_versions
18
18
 
@@ -131,7 +131,7 @@ def filter_matching_boards(answers: dict) -> Sequence[Tuple[str, str]]:
131
131
  # Get the values of the dictionary, which are the unique items from the original list
132
132
  some_boards = list(unique_dict.values())
133
133
  else:
134
- some_boards = [("No boards found", "")]
134
+ some_boards = [(f"No {answers['port']} boards found for version(s) {_versions}", "")]
135
135
  return some_boards
136
136
 
137
137
 
@@ -186,12 +186,27 @@ def ask_versions(questions: list, *, action: str):
186
186
  """
187
187
  # import only when needed to reduce load time
188
188
  import inquirer
189
+ import inquirer.errors
189
190
 
190
191
  input_ux = inquirer.Checkbox if action == "download" else inquirer.List
191
192
  mp_versions: List[str] = micropython_versions()
192
193
  mp_versions = [v for v in mp_versions if "preview" not in v]
194
+
195
+ # remove the versions for which there are no known boards in the board_info.json
196
+ # todo: this may be a little slow
197
+ mp_versions = [v for v in mp_versions if get_stored_boards_for_port("stm32", [v])]
198
+
193
199
  mp_versions.append("preview")
194
200
  mp_versions.reverse() # newest first
201
+
202
+ def at_least_one_validation(answers, current) -> bool:
203
+ if not current:
204
+ raise inquirer.errors.ValidationError("", reason="Please select at least one version")
205
+ if isinstance(current, list):
206
+ if not any(current):
207
+ raise inquirer.errors.ValidationError("", reason="Please select at least one version")
208
+ return True
209
+
195
210
  questions.append(
196
211
  input_ux(
197
212
  # inquirer.List(
@@ -201,7 +216,7 @@ def ask_versions(questions: list, *, action: str):
201
216
  # hints=["Use space to select multiple options"],
202
217
  choices=mp_versions,
203
218
  autocomplete=True,
204
- validate=lambda _, x: True if x else "Please select at least one version", # type: ignore
219
+ validate=at_least_one_validation,
205
220
  )
206
221
  )
207
222