micropython-stubber 1.24.1__py3-none-any.whl → 1.24.4__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 (90) hide show
  1. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/METADATA +9 -29
  2. micropython_stubber-1.24.4.dist-info/RECORD +107 -0
  3. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/WHEEL +1 -1
  4. stubber/__init__.py +1 -1
  5. stubber/board/createstubs.py +44 -38
  6. stubber/board/createstubs_db.py +17 -12
  7. stubber/board/createstubs_db_min.py +63 -63
  8. stubber/board/createstubs_db_mpy.mpy +0 -0
  9. stubber/board/createstubs_mem.py +17 -12
  10. stubber/board/createstubs_mem_min.py +99 -99
  11. stubber/board/createstubs_mem_mpy.mpy +0 -0
  12. stubber/board/createstubs_min.py +111 -112
  13. stubber/board/createstubs_mpy.mpy +0 -0
  14. stubber/board/modulelist.txt +27 -27
  15. stubber/codemod/board.py +1 -1
  16. stubber/codemod/enrich.py +13 -13
  17. stubber/codemod/merge_docstub.py +83 -53
  18. stubber/codemod/visitors/type_helpers.py +143 -41
  19. stubber/commands/enrich_folder_cmd.py +17 -17
  20. stubber/commands/get_docstubs_cmd.py +27 -9
  21. stubber/commands/get_frozen_cmd.py +1 -0
  22. stubber/commands/merge_cmd.py +2 -4
  23. stubber/merge_config.py +5 -36
  24. stubber/minify.py +3 -3
  25. stubber/modcat.py +118 -0
  26. stubber/publish/merge_docstubs.py +22 -5
  27. stubber/publish/stubpackage.py +33 -28
  28. stubber/rst/lookup.py +6 -23
  29. stubber/rst/reader.py +8 -13
  30. stubber/stubs_from_docs.py +2 -1
  31. stubber/tools/manifestfile.py +2 -1
  32. stubber/{cst_transformer.py → typing_collector.py} +36 -4
  33. micropython_stubber-1.24.1.dist-info/RECORD +0 -161
  34. mpflash/README.md +0 -220
  35. mpflash/libusb_flash.ipynb +0 -203
  36. mpflash/mpflash/__init__.py +0 -0
  37. mpflash/mpflash/add_firmware.py +0 -98
  38. mpflash/mpflash/ask_input.py +0 -236
  39. mpflash/mpflash/basicgit.py +0 -324
  40. mpflash/mpflash/bootloader/__init__.py +0 -2
  41. mpflash/mpflash/bootloader/activate.py +0 -60
  42. mpflash/mpflash/bootloader/detect.py +0 -82
  43. mpflash/mpflash/bootloader/manual.py +0 -101
  44. mpflash/mpflash/bootloader/micropython.py +0 -12
  45. mpflash/mpflash/bootloader/touch1200.py +0 -36
  46. mpflash/mpflash/cli_download.py +0 -129
  47. mpflash/mpflash/cli_flash.py +0 -224
  48. mpflash/mpflash/cli_group.py +0 -111
  49. mpflash/mpflash/cli_list.py +0 -87
  50. mpflash/mpflash/cli_main.py +0 -39
  51. mpflash/mpflash/common.py +0 -217
  52. mpflash/mpflash/config.py +0 -44
  53. mpflash/mpflash/connected.py +0 -96
  54. mpflash/mpflash/download.py +0 -364
  55. mpflash/mpflash/downloaded.py +0 -138
  56. mpflash/mpflash/errors.py +0 -9
  57. mpflash/mpflash/flash/__init__.py +0 -55
  58. mpflash/mpflash/flash/esp.py +0 -59
  59. mpflash/mpflash/flash/stm32.py +0 -19
  60. mpflash/mpflash/flash/stm32_dfu.py +0 -104
  61. mpflash/mpflash/flash/uf2/__init__.py +0 -88
  62. mpflash/mpflash/flash/uf2/boardid.py +0 -15
  63. mpflash/mpflash/flash/uf2/linux.py +0 -136
  64. mpflash/mpflash/flash/uf2/macos.py +0 -42
  65. mpflash/mpflash/flash/uf2/uf2disk.py +0 -12
  66. mpflash/mpflash/flash/uf2/windows.py +0 -43
  67. mpflash/mpflash/flash/worklist.py +0 -170
  68. mpflash/mpflash/list.py +0 -106
  69. mpflash/mpflash/logger.py +0 -41
  70. mpflash/mpflash/mpboard_id/__init__.py +0 -98
  71. mpflash/mpflash/mpboard_id/add_boards.py +0 -262
  72. mpflash/mpflash/mpboard_id/board.py +0 -37
  73. mpflash/mpflash/mpboard_id/board_id.py +0 -90
  74. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  75. mpflash/mpflash/mpboard_id/store.py +0 -48
  76. mpflash/mpflash/mpremoteboard/__init__.py +0 -271
  77. mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -152
  78. mpflash/mpflash/mpremoteboard/runner.py +0 -140
  79. mpflash/mpflash/vendor/board_database.py +0 -185
  80. mpflash/mpflash/vendor/click_aliases.py +0 -91
  81. mpflash/mpflash/vendor/dfu.py +0 -165
  82. mpflash/mpflash/vendor/pydfu.py +0 -605
  83. mpflash/mpflash/vendor/readme.md +0 -12
  84. mpflash/mpflash/versions.py +0 -123
  85. mpflash/poetry.lock +0 -2603
  86. mpflash/pyproject.toml +0 -66
  87. mpflash/stm32_udev_rules.md +0 -63
  88. stubber/codemod/test_enrich.py +0 -87
  89. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/LICENSE +0 -0
  90. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/entry_points.txt +0 -0
@@ -1,123 +0,0 @@
1
- """
2
- Version handling for mpflash and micropython-stubber
3
- """
4
-
5
- from pathlib import Path
6
-
7
- from cache_to_disk import NoCacheCondition, cache_to_disk
8
- from loguru import logger as log
9
- from packaging.version import Version, parse
10
-
11
- import mpflash.basicgit as git
12
- from mpflash.common import GH_CLIENT
13
-
14
- OLDEST_VERSION = "1.16"
15
- "This is the oldest MicroPython version to build the stubs on"
16
-
17
- V_PREVIEW = "preview"
18
- "Latest preview version"
19
-
20
- SET_PREVIEW = {"preview", "latest", "master"}
21
-
22
-
23
- def clean_version(
24
- version: str,
25
- *,
26
- build: bool = False,
27
- patch: bool = False,
28
- commit: bool = False,
29
- drop_v: bool = False,
30
- flat: bool = False,
31
- ): # sourcery skip: assign-if-exp
32
- "Clean up and transform the many flavours of versions"
33
- # 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
34
- if version in {"", "-"}:
35
- return version
36
- if version.lower() == "stable":
37
- _v = get_stable_mp_version()
38
- if not _v:
39
- log.warning("Could not determine the latest stable version")
40
- return "stable"
41
- version = _v
42
- log.trace(f"Using latest stable version: {version}")
43
- is_preview = "-preview" in version
44
- nibbles = version.split("-")
45
- ver_ = nibbles[0].lower().lstrip("v")
46
- if not patch and ver_ >= "1.10.0" and ver_ < "1.20.0" and ver_.endswith(".0"):
47
- # remove the last ".0" - but only for versions between 1.10 and 1.20 (because)
48
- nibbles[0] = nibbles[0][:-2]
49
- if len(nibbles) == 1:
50
- version = nibbles[0]
51
- elif build and not is_preview:
52
- # HACK: this is not always right, but good enough most of the time
53
- version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
54
- elif is_preview:
55
- version = "-".join((nibbles[0], V_PREVIEW))
56
- else:
57
- version = V_PREVIEW
58
- if flat:
59
- version = version.strip().replace(".", "_").replace("-", "_")
60
- else:
61
- version = version.strip().replace("_preview", "-preview").replace("_", ".")
62
-
63
- if drop_v:
64
- version = version.lstrip("v")
65
- elif not version.startswith("v") and version.lower() not in SET_PREVIEW:
66
- version = "v" + version
67
- if version in SET_PREVIEW:
68
- version = V_PREVIEW
69
- return version
70
-
71
-
72
- def is_version(version: str):
73
- """Check if the version is a valid version string"""
74
- return Version._regex.search(version) is not None
75
-
76
-
77
- @cache_to_disk(n_days_to_cache=1)
78
- def micropython_versions(minver: str = "v1.20", reverse: bool = False, cache_it=True):
79
- """Get the list of micropython versions from github tags"""
80
-
81
- try:
82
- gh_client = GH_CLIENT
83
- repo = gh_client.get_repo("micropython/micropython")
84
- tags = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
85
- versions = [v for v in tags if not v.endswith(V_PREVIEW)]
86
- # Only keep the last preview
87
- preview = sorted([v for v in tags if v.endswith(V_PREVIEW)], reverse=True)[0]
88
- versions.append(preview)
89
- except Exception as e:
90
- log.error(e)
91
- versions = []
92
- # returns - but does not cache
93
- raise NoCacheCondition(function_value=versions)
94
- # remove any duplicates and sort
95
- versions = sorted(list(set(versions)), reverse=reverse, key=lambda s: (not is_version(s), s))
96
- if cache_it:
97
- return versions
98
- # returns - but does not cache
99
- raise NoCacheCondition(function_value=versions)
100
-
101
-
102
- def get_stable_mp_version(cache_it=True) -> str:
103
- # read the versions from the git tags
104
- all_versions = micropython_versions(minver=OLDEST_VERSION, cache_it=cache_it)
105
- versions = [v for v in all_versions if not v.endswith(V_PREVIEW)]
106
- return versions[-1] if versions else ""
107
-
108
-
109
- def get_preview_mp_version(cache_it=True) -> str:
110
- # read the versions from the git tags
111
- all_versions = micropython_versions(minver=OLDEST_VERSION, cache_it=cache_it)
112
- versions = [v for v in all_versions if v.endswith(V_PREVIEW)]
113
- return versions[0] if versions else ""
114
-
115
-
116
- # Do not cache , same path will have different versions checked out
117
- def checkedout_version(path: Path, flat: bool = False) -> str:
118
- """Get the checked-out version of the repo"""
119
- version = git.get_local_tag(path.as_posix())
120
- if not version:
121
- raise ValueError("No valid Tag found")
122
- version = clean_version(version, flat=flat, drop_v=False)
123
- return version