micropython-stubber 1.23.0__py3-none-any.whl → 1.23.1.post1__py3-none-any.whl

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 (110) hide show
  1. {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.post1.dist-info}/METADATA +32 -14
  2. micropython_stubber-1.23.1.post1.dist-info/RECORD +159 -0
  3. micropython_stubber-1.23.1.post1.dist-info/entry_points.txt +5 -0
  4. mpflash/README.md +40 -4
  5. mpflash/mpflash/add_firmware.py +1 -1
  6. mpflash/mpflash/ask_input.py +1 -1
  7. {stubber → mpflash/mpflash}/basicgit.py +3 -13
  8. mpflash/mpflash/bootloader/__init__.py +2 -37
  9. mpflash/mpflash/bootloader/activate.py +60 -0
  10. mpflash/mpflash/bootloader/detect.py +82 -0
  11. mpflash/mpflash/bootloader/manual.py +10 -11
  12. mpflash/mpflash/bootloader/micropython.py +2 -0
  13. mpflash/mpflash/bootloader/touch1200.py +13 -22
  14. mpflash/mpflash/cli_download.py +2 -2
  15. mpflash/mpflash/cli_flash.py +13 -16
  16. mpflash/mpflash/cli_group.py +18 -5
  17. mpflash/mpflash/cli_list.py +8 -2
  18. mpflash/mpflash/cli_main.py +3 -5
  19. mpflash/mpflash/common.py +3 -1
  20. mpflash/mpflash/config.py +2 -1
  21. mpflash/mpflash/connected.py +11 -8
  22. mpflash/mpflash/download.py +9 -5
  23. mpflash/mpflash/downloaded.py +1 -1
  24. mpflash/mpflash/{flash.py → flash/__init__.py} +3 -3
  25. mpflash/mpflash/{flash_esp.py → flash/esp.py} +1 -1
  26. mpflash/mpflash/{flash_stm32.py → flash/stm32.py} +4 -3
  27. mpflash/mpflash/{flash_stm32_dfu.py → flash/stm32_dfu.py} +1 -1
  28. mpflash/mpflash/{flash_uf2.py → flash/uf2/__init__.py} +19 -20
  29. mpflash/mpflash/{flash_uf2_linux.py → flash/uf2/linux.py} +12 -11
  30. mpflash/mpflash/{flash_uf2_macos.py → flash/uf2/macos.py} +11 -6
  31. mpflash/mpflash/{flash_uf2_windows.py → flash/uf2/windows.py} +11 -6
  32. mpflash/mpflash/{worklist.py → flash/worklist.py} +8 -9
  33. mpflash/mpflash/list.py +26 -9
  34. mpflash/mpflash/mpboard_id/__init__.py +1 -1
  35. mpflash/mpflash/mpboard_id/add_boards.py +3 -7
  36. mpflash/mpflash/mpboard_id/board_id.py +1 -1
  37. mpflash/mpflash/mpremoteboard/__init__.py +57 -17
  38. {stubber/utils → mpflash/mpflash}/versions.py +31 -24
  39. mpflash/poetry.lock +16 -5
  40. mpflash/pyproject.toml +4 -3
  41. stubber/__init__.py +1 -1
  42. stubber/board/createstubs.py +4 -4
  43. stubber/board/createstubs_db.py +5 -5
  44. stubber/board/createstubs_db_min.py +1 -1
  45. stubber/board/createstubs_db_mpy.mpy +0 -0
  46. stubber/board/createstubs_mem.py +5 -5
  47. stubber/board/createstubs_mem_min.py +1 -1
  48. stubber/board/createstubs_mem_mpy.mpy +0 -0
  49. stubber/board/createstubs_min.py +1 -1
  50. stubber/board/createstubs_mpy.mpy +0 -0
  51. stubber/bulk/mcu_stubber.py +28 -45
  52. stubber/codemod/enrich.py +1 -1
  53. stubber/codemod/merge_docstub.py +1 -1
  54. stubber/codemod/utils.py +2 -3
  55. stubber/commands/build_cmd.py +1 -1
  56. stubber/commands/cli.py +6 -12
  57. stubber/commands/clone_cmd.py +3 -2
  58. stubber/commands/config_cmd.py +1 -1
  59. stubber/commands/enrich_folder_cmd.py +1 -1
  60. stubber/commands/get_core_cmd.py +1 -1
  61. stubber/commands/get_docstubs_cmd.py +6 -3
  62. stubber/commands/get_frozen_cmd.py +6 -3
  63. stubber/commands/get_mcu_cmd.py +53 -12
  64. stubber/commands/merge_cmd.py +2 -3
  65. stubber/commands/publish_cmd.py +2 -3
  66. stubber/commands/stub_cmd.py +1 -1
  67. stubber/commands/switch_cmd.py +2 -2
  68. stubber/commands/variants_cmd.py +2 -3
  69. stubber/downloader.py +2 -1
  70. stubber/freeze/common.py +7 -3
  71. stubber/freeze/freeze_folder.py +2 -2
  72. stubber/freeze/freeze_manifest_2.py +19 -6
  73. stubber/freeze/get_frozen.py +8 -4
  74. stubber/get_cpython.py +15 -4
  75. stubber/minify.py +11 -6
  76. stubber/publish/candidates.py +20 -7
  77. stubber/publish/defaults.py +4 -9
  78. stubber/publish/merge_docstubs.py +4 -2
  79. stubber/publish/missing_class_methods.py +5 -3
  80. stubber/publish/package.py +8 -4
  81. stubber/publish/pathnames.py +2 -2
  82. stubber/publish/publish.py +2 -2
  83. stubber/publish/pypi.py +6 -2
  84. stubber/publish/stubpackage.py +39 -17
  85. stubber/rst/classsort.py +2 -1
  86. stubber/rst/lookup.py +1 -0
  87. stubber/rst/reader.py +12 -20
  88. stubber/rst/report_return.py +12 -4
  89. stubber/rst/rst_utils.py +2 -1
  90. stubber/stubs_from_docs.py +1 -1
  91. stubber/tools/manifestfile.py +1 -2
  92. stubber/update_fallback.py +2 -2
  93. stubber/update_module_list.py +1 -1
  94. stubber/utils/__init__.py +2 -1
  95. stubber/utils/config.py +18 -8
  96. stubber/utils/manifest.py +2 -4
  97. stubber/utils/post.py +2 -1
  98. stubber/utils/repos.py +4 -5
  99. stubber/utils/stubmaker.py +1 -1
  100. stubber/utils/typed_config_toml.py +5 -2
  101. stubber/variants.py +1 -1
  102. micropython_stubber-1.23.0.dist-info/RECORD +0 -159
  103. micropython_stubber-1.23.0.dist-info/entry_points.txt +0 -3
  104. mpflash/mpflash/flash_stm32_cube.py +0 -111
  105. mpflash/mpflash/vendor/versions.py +0 -119
  106. {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.post1.dist-info}/LICENSE +0 -0
  107. {micropython_stubber-1.23.0.dist-info → micropython_stubber-1.23.1.post1.dist-info}/WHEEL +0 -0
  108. /mpflash/{mpflash/vendor/basicgit.py → basicgit.py} +0 -0
  109. /mpflash/mpflash/{flash_uf2_boardid.py → flash/uf2/boardid.py} +0 -0
  110. /mpflash/mpflash/{uf2disk.py → flash/uf2/uf2disk.py} +0 -0
@@ -1,119 +0,0 @@
1
- """
2
- #############################################################
3
- # Version handling copied from stubber/utils/versions.py
4
- #############################################################
5
- """
6
-
7
- from functools import lru_cache
8
-
9
- from loguru import logger as log
10
- from packaging.version import parse
11
-
12
- from mpflash.common import GH_CLIENT
13
- OLDEST_VERSION = "1.16"
14
- "This is the oldest MicroPython version to build the stubs on"
15
-
16
- V_PREVIEW = "preview"
17
- "Latest preview version"
18
-
19
- SET_PREVIEW = {"preview", "latest", "master"}
20
-
21
-
22
- def clean_version(
23
- version: str,
24
- *,
25
- build: bool = False,
26
- patch: bool = False,
27
- commit: bool = False,
28
- drop_v: bool = False,
29
- flat: bool = False,
30
- ):
31
- "Clean up and transform the many flavours of versions"
32
- # 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
33
- if version in {"", "-"}:
34
- return version
35
- if version.lower() == "stable":
36
- _v = get_stable_mp_version()
37
- if not _v:
38
- log.warning("Could not determine the latest stable version")
39
- return "stable"
40
- version = _v
41
- log.trace(f"Using latest stable version: {version}")
42
- is_preview = "-preview" in version
43
- nibbles = version.split("-")
44
- ver_ = nibbles[0].lower().lstrip("v")
45
- if not patch and ver_ >= "1.10.0" and ver_ < "1.20.0" and ver_.endswith(".0"):
46
- # remove the last ".0" - but only for versions between 1.10 and 1.20 (because)
47
- nibbles[0] = nibbles[0][:-2]
48
- if len(nibbles) == 1:
49
- version = nibbles[0]
50
- elif build and not is_preview:
51
- version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
52
- else:
53
- # version = "-".join((nibbles[0], LATEST))
54
- # HACK: this is not always right, but good enough most of the time
55
- if is_preview:
56
- version = "-".join((nibbles[0], V_PREVIEW))
57
- else:
58
- version = V_PREVIEW
59
- if flat:
60
- version = version.strip().replace(".", "_").replace("-", "_")
61
- else:
62
- version = version.strip().replace("_preview", "-preview").replace("_", ".")
63
-
64
- if drop_v:
65
- version = version.lstrip("v")
66
- elif not version.startswith("v") and version.lower() not in SET_PREVIEW:
67
- version = "v" + version
68
- if version in SET_PREVIEW:
69
- version = V_PREVIEW
70
- return version
71
-
72
-
73
- @lru_cache(maxsize=10)
74
- def micropython_versions(minver: str = "v1.20", reverse: bool = False):
75
- """Get the list of micropython versions from github tags"""
76
- try:
77
- gh_client = GH_CLIENT
78
- repo = gh_client.get_repo("micropython/micropython")
79
- versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
80
- # Only keep the last preview
81
- versions = [v for v in versions if not v.endswith(V_PREVIEW) or v == versions[-1]]
82
- except Exception:
83
- versions = [
84
- "v9.99.9-preview",
85
- "v1.22.2",
86
- "v1.22.1",
87
- "v1.22.0",
88
- "v1.21.1",
89
- "v1.21.0",
90
- "v1.20.0",
91
- "v1.19.1",
92
- "v1.19",
93
- "v1.18",
94
- "v1.17",
95
- "v1.16",
96
- "v1.15",
97
- "v1.14",
98
- "v1.13",
99
- "v1.12",
100
- "v1.11",
101
- "v1.10",
102
- ]
103
- versions = [v for v in versions if parse(v) >= parse(minver)]
104
- # remove all but the most recent (preview) version
105
- versions = versions[:1] + [v for v in versions if "preview" not in v]
106
- return sorted(versions, reverse=reverse)
107
-
108
-
109
- def get_stable_mp_version() -> str:
110
- # read the versions from the git tags
111
- all_versions = micropython_versions(minver=OLDEST_VERSION)
112
- return [v for v in all_versions if not v.endswith(V_PREVIEW)][-1]
113
-
114
-
115
- def get_preview_mp_version() -> str:
116
- # read the versions from the git tags
117
- all_versions = micropython_versions(minver=OLDEST_VERSION)
118
- return [v for v in all_versions if v.endswith(V_PREVIEW)][-1]
119
-
File without changes
File without changes