micropython-stubber 1.20.6__py3-none-any.whl → 1.23.1__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.
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/METADATA +4 -3
- micropython_stubber-1.23.1.dist-info/RECORD +159 -0
- mpflash/README.md +14 -4
- mpflash/mpflash/add_firmware.py +1 -1
- mpflash/mpflash/ask_input.py +1 -1
- {stubber → mpflash/mpflash}/basicgit.py +3 -13
- mpflash/mpflash/bootloader/__init__.py +2 -37
- mpflash/mpflash/bootloader/activate.py +60 -0
- mpflash/mpflash/bootloader/detect.py +82 -0
- mpflash/mpflash/bootloader/manual.py +10 -11
- mpflash/mpflash/bootloader/micropython.py +2 -0
- mpflash/mpflash/bootloader/touch1200.py +13 -22
- mpflash/mpflash/cli_download.py +1 -1
- mpflash/mpflash/cli_flash.py +4 -4
- mpflash/mpflash/cli_group.py +18 -5
- mpflash/mpflash/cli_main.py +3 -5
- mpflash/mpflash/common.py +1 -0
- mpflash/mpflash/config.py +6 -9
- mpflash/mpflash/connected.py +9 -5
- mpflash/mpflash/download.py +9 -5
- mpflash/mpflash/downloaded.py +4 -3
- mpflash/mpflash/{flash.py → flash/__init__.py} +20 -17
- mpflash/mpflash/{flash_esp.py → flash/esp.py} +1 -1
- mpflash/mpflash/flash/stm32.py +19 -0
- mpflash/mpflash/{flash_stm32_dfu.py → flash/stm32_dfu.py} +4 -1
- mpflash/mpflash/{flash_uf2.py → flash/uf2/__init__.py} +44 -23
- mpflash/mpflash/{flash_uf2_linux.py → flash/uf2/linux.py} +15 -8
- mpflash/mpflash/{flash_uf2_macos.py → flash/uf2/macos.py} +13 -5
- mpflash/mpflash/{flash_uf2_windows.py → flash/uf2/windows.py} +16 -7
- mpflash/mpflash/{worklist.py → flash/worklist.py} +9 -9
- mpflash/mpflash/list.py +13 -3
- mpflash/mpflash/mpboard_id/__init__.py +1 -1
- mpflash/mpflash/mpboard_id/add_boards.py +3 -7
- mpflash/mpflash/mpboard_id/board_id.py +1 -1
- mpflash/mpflash/mpremoteboard/__init__.py +5 -4
- {stubber/utils → mpflash/mpflash}/versions.py +31 -24
- mpflash/poetry.lock +16 -5
- mpflash/pyproject.toml +8 -3
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +4 -4
- stubber/board/createstubs_db.py +5 -5
- stubber/board/createstubs_db_min.py +1 -1
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +5 -5
- stubber/board/createstubs_mem_min.py +1 -1
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +1 -1
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/codemod/utils.py +2 -3
- stubber/commands/build_cmd.py +1 -1
- stubber/commands/cli.py +8 -4
- stubber/commands/clone_cmd.py +16 -4
- stubber/commands/enrich_folder_cmd.py +2 -1
- stubber/commands/get_core_cmd.py +5 -3
- stubber/commands/get_docstubs_cmd.py +6 -4
- stubber/commands/get_frozen_cmd.py +5 -3
- stubber/commands/get_mcu_cmd.py +9 -4
- stubber/commands/merge_cmd.py +3 -3
- stubber/commands/publish_cmd.py +2 -3
- stubber/commands/stub_cmd.py +2 -1
- stubber/commands/switch_cmd.py +14 -6
- stubber/commands/variants_cmd.py +3 -3
- stubber/freeze/get_frozen.py +1 -1
- stubber/minify.py +4 -3
- stubber/publish/candidates.py +4 -10
- stubber/publish/defaults.py +4 -9
- stubber/publish/missing_class_methods.py +1 -1
- stubber/publish/package.py +1 -1
- stubber/publish/pathnames.py +1 -1
- stubber/publish/publish.py +1 -1
- stubber/publish/stubpackage.py +3 -5
- stubber/rst/reader.py +5 -13
- stubber/tools/manifestfile.py +71 -27
- stubber/tools/readme.md +3 -2
- stubber/update_fallback.py +1 -1
- stubber/utils/__init__.py +2 -1
- stubber/utils/config.py +3 -5
- stubber/utils/manifest.py +2 -4
- stubber/utils/repos.py +5 -12
- micropython_stubber-1.20.6.dist-info/RECORD +0 -159
- mpflash/mpflash/flash_stm32.py +0 -24
- mpflash/mpflash/flash_stm32_cube.py +0 -111
- mpflash/mpflash/vendor/versions.py +0 -119
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.20.6.dist-info → micropython_stubber-1.23.1.dist-info}/entry_points.txt +0 -0
- /mpflash/{mpflash/vendor/basicgit.py → basicgit.py} +0 -0
- /mpflash/mpflash/{flash_uf2_boardid.py → flash/uf2/boardid.py} +0 -0
- /mpflash/mpflash/{uf2disk.py → flash/uf2/uf2disk.py} +0 -0
@@ -12,11 +12,11 @@ import rich.table
|
|
12
12
|
from rich.console import Console
|
13
13
|
from rich.progress import track
|
14
14
|
|
15
|
-
import mpflash.
|
15
|
+
import mpflash.basicgit as git
|
16
16
|
from mpflash.logger import log
|
17
17
|
from mpflash.mpboard_id import Board
|
18
18
|
from mpflash.mpboard_id.store import write_boardinfo_json
|
19
|
-
from mpflash.
|
19
|
+
from mpflash.versions import micropython_versions
|
20
20
|
|
21
21
|
# look for all mpconfigboard.h files and extract the board name
|
22
22
|
# from the #define MICROPY_HW_BOARD_NAME "PYBD_SF6"
|
@@ -222,11 +222,7 @@ def make_table(board_list: List[Board]) -> rich.table.Table:
|
|
222
222
|
|
223
223
|
def ask_mpy_path():
|
224
224
|
"""Ask the user for the path to the MicroPython repository."""
|
225
|
-
questions = [
|
226
|
-
inquirer.Text(
|
227
|
-
"mpy_path", message="Enter the path to the MicroPython repository", default=".\\repos\\micropython"
|
228
|
-
)
|
229
|
-
]
|
225
|
+
questions = [inquirer.Text("mpy_path", message="Enter the path to the MicroPython repository", default=".\\repos\\micropython")]
|
230
226
|
if answers := inquirer.prompt(questions):
|
231
227
|
return Path(answers["mpy_path"])
|
232
228
|
else:
|
@@ -9,7 +9,7 @@ from typing import Optional
|
|
9
9
|
from mpflash.errors import MPFlashError
|
10
10
|
from mpflash.logger import log
|
11
11
|
from mpflash.mpboard_id.store import read_known_boardinfo
|
12
|
-
from mpflash.
|
12
|
+
from mpflash.versions import clean_version, get_stable_mp_version
|
13
13
|
|
14
14
|
|
15
15
|
def find_board_id_by_description(
|
@@ -29,7 +29,7 @@ RETRIES = 3
|
|
29
29
|
class MPRemoteBoard:
|
30
30
|
"""Class to run mpremote commands"""
|
31
31
|
|
32
|
-
def __init__(self, serialport: str = "", update: bool = False):
|
32
|
+
def __init__(self, serialport: str = "", update: bool = False, *, location: str = ""):
|
33
33
|
"""
|
34
34
|
Initialize MPRemoteBoard object.
|
35
35
|
|
@@ -37,7 +37,7 @@ class MPRemoteBoard:
|
|
37
37
|
- serialport (str): The serial port to connect to. Default is an empty string.
|
38
38
|
- update (bool): Whether to update the MCU information. Default is False.
|
39
39
|
"""
|
40
|
-
self.serialport = serialport
|
40
|
+
self.serialport: str = serialport
|
41
41
|
self.firmware = {}
|
42
42
|
|
43
43
|
self.connected = False
|
@@ -51,6 +51,7 @@ class MPRemoteBoard:
|
|
51
51
|
self.arch = ""
|
52
52
|
self.mpy = ""
|
53
53
|
self.build = ""
|
54
|
+
self.location = location
|
54
55
|
if update:
|
55
56
|
self.get_mcu_info()
|
56
57
|
|
@@ -207,11 +208,11 @@ class MPRemoteBoard:
|
|
207
208
|
"""wait for the board to restart"""
|
208
209
|
for _ in track(
|
209
210
|
range(timeout),
|
210
|
-
description="Waiting for the board to restart",
|
211
|
+
description=f"Waiting for the board to restart ({timeout}s)",
|
211
212
|
transient=True,
|
212
|
-
get_time=lambda: time.time(),
|
213
213
|
show_speed=False,
|
214
214
|
refresh_per_second=1,
|
215
|
+
total=timeout,
|
215
216
|
):
|
216
217
|
time.sleep(1)
|
217
218
|
try:
|
@@ -1,14 +1,17 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
#############################################################
|
3
|
+
# Version handling copied from stubber/utils/versions.py
|
4
|
+
#############################################################
|
5
|
+
"""
|
2
6
|
|
3
|
-
from functools import lru_cache
|
4
7
|
from pathlib import Path
|
5
8
|
|
6
|
-
from
|
9
|
+
from cache_to_disk import NoCacheCondition, cache_to_disk
|
7
10
|
from loguru import logger as log
|
8
11
|
from packaging.version import parse
|
9
12
|
|
10
|
-
import
|
11
|
-
|
13
|
+
import mpflash.basicgit as git
|
14
|
+
from mpflash.common import GH_CLIENT
|
12
15
|
|
13
16
|
OLDEST_VERSION = "1.16"
|
14
17
|
"This is the oldest MicroPython version to build the stubs on"
|
@@ -27,7 +30,7 @@ def clean_version(
|
|
27
30
|
commit: bool = False,
|
28
31
|
drop_v: bool = False,
|
29
32
|
flat: bool = False,
|
30
|
-
):
|
33
|
+
): # sourcery skip: assign-if-exp
|
31
34
|
"Clean up and transform the many flavours of versions"
|
32
35
|
# 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
|
33
36
|
if version in {"", "-"}:
|
@@ -48,14 +51,12 @@ def clean_version(
|
|
48
51
|
if len(nibbles) == 1:
|
49
52
|
version = nibbles[0]
|
50
53
|
elif build and not is_preview:
|
54
|
+
# HACK: this is not always right, but good enough most of the time
|
51
55
|
version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
|
56
|
+
elif is_preview:
|
57
|
+
version = "-".join((nibbles[0], V_PREVIEW))
|
52
58
|
else:
|
53
|
-
|
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
|
+
version = V_PREVIEW
|
59
60
|
if flat:
|
60
61
|
version = version.strip().replace(".", "_").replace("-", "_")
|
61
62
|
else:
|
@@ -70,20 +71,12 @@ def clean_version(
|
|
70
71
|
return version
|
71
72
|
|
72
73
|
|
73
|
-
@
|
74
|
-
def checkedout_version(path: Path, flat: bool = False) -> str:
|
75
|
-
"""Get the checked-out version of the repo"""
|
76
|
-
version = git.get_local_tag(path.as_posix())
|
77
|
-
if not version:
|
78
|
-
raise ValueError("No valid Tag found")
|
79
|
-
version = utils.clean_version(version, flat=flat, drop_v=False)
|
80
|
-
return version
|
81
|
-
|
82
|
-
|
74
|
+
@cache_to_disk(n_days_to_cache=1)
|
83
75
|
def micropython_versions(minver: str = "v1.20", reverse: bool = False):
|
84
76
|
"""Get the list of micropython versions from github tags"""
|
77
|
+
cache_it = True
|
85
78
|
try:
|
86
|
-
gh_client =
|
79
|
+
gh_client = GH_CLIENT
|
87
80
|
repo = gh_client.get_repo("micropython/micropython")
|
88
81
|
versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
|
89
82
|
# Only keep the last preview
|
@@ -109,10 +102,15 @@ def micropython_versions(minver: str = "v1.20", reverse: bool = False):
|
|
109
102
|
"v1.11",
|
110
103
|
"v1.10",
|
111
104
|
]
|
105
|
+
cache_it = False
|
112
106
|
versions = [v for v in versions if parse(v) >= parse(minver)]
|
113
107
|
# remove all but the most recent (preview) version
|
114
108
|
versions = versions[:1] + [v for v in versions if "preview" not in v]
|
115
|
-
|
109
|
+
versions = sorted(versions, reverse=reverse)
|
110
|
+
if cache_it:
|
111
|
+
return versions
|
112
|
+
# returns - but does not cache
|
113
|
+
raise NoCacheCondition(function_value=versions)
|
116
114
|
|
117
115
|
|
118
116
|
def get_stable_mp_version() -> str:
|
@@ -126,3 +124,12 @@ def get_preview_mp_version() -> str:
|
|
126
124
|
all_versions = micropython_versions(minver=OLDEST_VERSION)
|
127
125
|
return [v for v in all_versions if v.endswith(V_PREVIEW)][-1]
|
128
126
|
|
127
|
+
|
128
|
+
# Do not cache , same path will have different versions checked out
|
129
|
+
def checkedout_version(path: Path, flat: bool = False) -> str:
|
130
|
+
"""Get the checked-out version of the repo"""
|
131
|
+
version = git.get_local_tag(path.as_posix())
|
132
|
+
if not version:
|
133
|
+
raise ValueError("No valid Tag found")
|
134
|
+
version = clean_version(version, flat=flat, drop_v=False)
|
135
|
+
return version
|
mpflash/poetry.lock
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# This file is automatically @generated by Poetry 1.8.
|
1
|
+
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
|
2
2
|
|
3
3
|
[[package]]
|
4
4
|
name = "ansicon"
|
@@ -249,6 +249,17 @@ files = [
|
|
249
249
|
{file = "blkinfo-0.2.0.tar.gz", hash = "sha256:322a906595f78832d6725ac74a0b9fd2794df3388584d9f05c1a2f8e19324851"},
|
250
250
|
]
|
251
251
|
|
252
|
+
[[package]]
|
253
|
+
name = "cache-to-disk"
|
254
|
+
version = "2.0.0"
|
255
|
+
description = "Local disk caching decorator for python function."
|
256
|
+
optional = false
|
257
|
+
python-versions = "*"
|
258
|
+
files = [
|
259
|
+
{file = "cache_to_disk-2.0.0-py3-none-any.whl", hash = "sha256:ea5afe13d4284cb4a06169b0807fbc60547cbe19c54563bf90e1d44f24029481"},
|
260
|
+
{file = "cache_to_disk-2.0.0.tar.gz", hash = "sha256:79e19ea9b72eedc5cec83bb8aa55374afc671493e7d13d541f3b63eb3a13fb32"},
|
261
|
+
]
|
262
|
+
|
252
263
|
[[package]]
|
253
264
|
name = "cachetools"
|
254
265
|
version = "5.3.3"
|
@@ -1452,13 +1463,13 @@ test = ["codecov", "coverage", "mypy", "nptyping (>=1.3.0)", "numpy", "pycodesty
|
|
1452
1463
|
|
1453
1464
|
[[package]]
|
1454
1465
|
name = "urllib3"
|
1455
|
-
version = "2.2.
|
1466
|
+
version = "2.2.2"
|
1456
1467
|
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
1457
1468
|
optional = false
|
1458
1469
|
python-versions = ">=3.8"
|
1459
1470
|
files = [
|
1460
|
-
{file = "urllib3-2.2.
|
1461
|
-
{file = "urllib3-2.2.
|
1471
|
+
{file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"},
|
1472
|
+
{file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"},
|
1462
1473
|
]
|
1463
1474
|
|
1464
1475
|
[package.extras]
|
@@ -1585,4 +1596,4 @@ files = [
|
|
1585
1596
|
[metadata]
|
1586
1597
|
lock-version = "2.0"
|
1587
1598
|
python-versions = ">=3.8.1,<4.0"
|
1588
|
-
content-hash = "
|
1599
|
+
content-hash = "e0f5697e08c8c691e538c586c7a478cdc93de23d56435373b56abdd2147bda87"
|
mpflash/pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "mpflash"
|
3
|
-
version = "0.
|
3
|
+
version = "0.9.1.Post2"
|
4
4
|
description = "Flash and download tool for MicroPython firmwares"
|
5
5
|
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
|
6
6
|
license = "MIT"
|
@@ -26,20 +26,25 @@ esptool = "^4.7.0"
|
|
26
26
|
inquirer = "^3.2.4"
|
27
27
|
jsonlines = "^4.0.0"
|
28
28
|
jsons = "^1.6.3"
|
29
|
-
libusb = {version = "^1.0.27", platform = "win32"}
|
29
|
+
libusb = { version = "^1.0.27", platform = "win32" }
|
30
30
|
loguru = "^0.7.2"
|
31
31
|
mpremote = "^1.22.0"
|
32
32
|
packaging = "23.2"
|
33
33
|
platformdirs = "^4.2.0"
|
34
34
|
psutil = "^5.9.8"
|
35
35
|
pygithub = "^2.1.1"
|
36
|
-
python =
|
36
|
+
python = ">=3.8.1,<4.0"
|
37
37
|
pyusb = "^1.2.1"
|
38
38
|
requests = "^2.31.0"
|
39
39
|
rich-click = "^1.8.1"
|
40
40
|
tenacity = "8.2.3"
|
41
|
+
cache-to-disk = "^2.0.0"
|
41
42
|
|
42
43
|
|
44
|
+
[tool.poetry.group.dev]
|
45
|
+
optional = true
|
46
|
+
[tool.poetry.group.dev.dependencies]
|
47
|
+
|
43
48
|
[tool.poetry.group.test]
|
44
49
|
optional = true
|
45
50
|
[tool.poetry.group.test.dependencies]
|
stubber/__init__.py
CHANGED
stubber/board/createstubs.py
CHANGED
@@ -24,7 +24,7 @@ try:
|
|
24
24
|
except ImportError:
|
25
25
|
from ucollections import OrderedDict # type: ignore
|
26
26
|
|
27
|
-
__version__ = "v1.
|
27
|
+
__version__ = "v1.23.1"
|
28
28
|
ENOENT = 2
|
29
29
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
30
30
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -488,7 +488,7 @@ def ensure_folder(path: str):
|
|
488
488
|
|
489
489
|
def _build(s):
|
490
490
|
# extract build from sys.version or os.uname().version if available
|
491
|
-
# sys.version: 'MicroPython v1.23.
|
491
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
492
492
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
493
493
|
if not s:
|
494
494
|
return ""
|
@@ -595,10 +595,10 @@ def _info(): # type:() -> dict[str, str]
|
|
595
595
|
if (
|
596
596
|
info["version"]
|
597
597
|
and info["version"].endswith(".0")
|
598
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.
|
598
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
599
599
|
and info["version"] <= "1.19.9"
|
600
600
|
):
|
601
|
-
# versions from 1.10.0 to 1.
|
601
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
602
602
|
info["version"] = info["version"][:-2]
|
603
603
|
|
604
604
|
# spell-checker: disable
|
stubber/board/createstubs_db.py
CHANGED
@@ -18,7 +18,7 @@ Create stubs for (all) modules on a MicroPython board.
|
|
18
18
|
- cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
|
19
19
|
|
20
20
|
|
21
|
-
This variant was generated from createstubs.py by micropython-stubber v1.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.1
|
22
22
|
"""
|
23
23
|
|
24
24
|
# Copyright (c) 2019-2024 Jos Verlinde
|
@@ -43,7 +43,7 @@ try:
|
|
43
43
|
except ImportError:
|
44
44
|
from ucollections import OrderedDict # type: ignore
|
45
45
|
|
46
|
-
__version__ = "v1.
|
46
|
+
__version__ = "v1.23.1"
|
47
47
|
ENOENT = 2
|
48
48
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
49
49
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -501,7 +501,7 @@ def ensure_folder(path: str):
|
|
501
501
|
|
502
502
|
def _build(s):
|
503
503
|
# extract build from sys.version or os.uname().version if available
|
504
|
-
# sys.version: 'MicroPython v1.23.
|
504
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
505
505
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
506
506
|
if not s:
|
507
507
|
return ""
|
@@ -606,10 +606,10 @@ def _info(): # type:() -> dict[str, str]
|
|
606
606
|
if (
|
607
607
|
info["version"]
|
608
608
|
and info["version"].endswith(".0")
|
609
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.
|
609
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
610
610
|
and info["version"] <= "1.19.9"
|
611
611
|
):
|
612
|
-
# versions from 1.10.0 to 1.
|
612
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
613
613
|
info["version"] = info["version"][:-2]
|
614
614
|
|
615
615
|
# spell-checker: disable
|
@@ -51,7 +51,7 @@ try:from machine import reset
|
|
51
51
|
except O:pass
|
52
52
|
try:from collections import OrderedDict as l
|
53
53
|
except O:from ucollections import OrderedDict as l
|
54
|
-
__version__='v1.
|
54
|
+
__version__='v1.23.1'
|
55
55
|
A3=2
|
56
56
|
A4=2
|
57
57
|
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
Binary file
|
stubber/board/createstubs_mem.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
- cross compilation, using mpy-cross,
|
10
10
|
to avoid the compilation step on the micropython device
|
11
11
|
|
12
|
-
This variant was generated from createstubs.py by micropython-stubber v1.
|
12
|
+
This variant was generated from createstubs.py by micropython-stubber v1.23.1
|
13
13
|
"""
|
14
14
|
|
15
15
|
# Copyright (c) 2019-2024 Jos Verlinde
|
@@ -34,7 +34,7 @@ try:
|
|
34
34
|
except ImportError:
|
35
35
|
from ucollections import OrderedDict # type: ignore
|
36
36
|
|
37
|
-
__version__ = "v1.
|
37
|
+
__version__ = "v1.23.1"
|
38
38
|
ENOENT = 2
|
39
39
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
40
40
|
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
|
@@ -492,7 +492,7 @@ def ensure_folder(path: str):
|
|
492
492
|
|
493
493
|
def _build(s):
|
494
494
|
# extract build from sys.version or os.uname().version if available
|
495
|
-
# sys.version: 'MicroPython v1.23.
|
495
|
+
# sys.version: 'MicroPython v1.23.1-preview.6.g3d0b6276f'
|
496
496
|
# sys.implementation.version: 'v1.13-103-gb137d064e'
|
497
497
|
if not s:
|
498
498
|
return ""
|
@@ -597,10 +597,10 @@ def _info(): # type:() -> dict[str, str]
|
|
597
597
|
if (
|
598
598
|
info["version"]
|
599
599
|
and info["version"].endswith(".0")
|
600
|
-
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.
|
600
|
+
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.23.1 do not have a micro .0
|
601
601
|
and info["version"] <= "1.19.9"
|
602
602
|
):
|
603
|
-
# versions from 1.10.0 to 1.
|
603
|
+
# versions from 1.10.0 to 1.23.1 do not have a micro .0
|
604
604
|
info["version"] = info["version"][:-2]
|
605
605
|
|
606
606
|
# spell-checker: disable
|
Binary file
|
stubber/board/createstubs_min.py
CHANGED
@@ -50,7 +50,7 @@ try:from machine import reset
|
|
50
50
|
except N:pass
|
51
51
|
try:from collections import OrderedDict as h
|
52
52
|
except N:from ucollections import OrderedDict as h
|
53
|
-
__version__='v1.
|
53
|
+
__version__='v1.23.1'
|
54
54
|
A0=2
|
55
55
|
A1=2
|
56
56
|
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
Binary file
|
stubber/codemod/utils.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
from libcst import matchers as m
|
3
|
-
from libcst.matchers._visitors import _gather_constructed_leave_funcs, _gather_constructed_visit_funcs
|
3
|
+
from libcst.matchers._visitors import _gather_constructed_leave_funcs, _gather_constructed_visit_funcs # type: ignore
|
4
4
|
from typing import Any, Optional
|
5
5
|
from types import FunctionType
|
6
6
|
import itertools
|
@@ -13,14 +13,13 @@ def shallow_copy_function(func: Any) -> FunctionType:
|
|
13
13
|
attributes defined on the function.
|
14
14
|
|
15
15
|
"""
|
16
|
-
|
16
|
+
return FunctionType(
|
17
17
|
func.__code__,
|
18
18
|
func.__globals__,
|
19
19
|
name=func.__name__,
|
20
20
|
argdefs=getattr(func, "__defaults__", None),
|
21
21
|
closure=getattr(func, "__closure__", None),
|
22
22
|
)
|
23
|
-
return ret
|
24
23
|
|
25
24
|
|
26
25
|
class ScopeableMatcherTransformer(m.MatcherDecoratableTransformer):
|
stubber/commands/build_cmd.py
CHANGED
stubber/commands/cli.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
"""
|
2
2
|
command line interface - main group
|
3
3
|
"""
|
4
|
+
|
4
5
|
import sys
|
5
6
|
|
6
|
-
import click
|
7
|
+
import rich_click as click
|
7
8
|
from loguru import logger as log
|
8
9
|
from stubber import __version__
|
9
10
|
|
@@ -11,11 +12,12 @@ from stubber import __version__
|
|
11
12
|
@click.group(chain=True)
|
12
13
|
@click.version_option(package_name="micropython-stubber", prog_name="micropython-stubber✏️ ")
|
13
14
|
@click.option(
|
14
|
-
"-
|
15
|
+
"-V",
|
16
|
+
"-V",
|
15
17
|
"--verbose",
|
16
18
|
count=True,
|
17
19
|
default=0,
|
18
|
-
help="-
|
20
|
+
help="-V for DEBUG, -VV for TRACE",
|
19
21
|
is_eager=True,
|
20
22
|
)
|
21
23
|
@click.pass_context
|
@@ -46,6 +48,8 @@ def set_loglevel(verbose: int) -> str:
|
|
46
48
|
else:
|
47
49
|
format_str = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
|
48
50
|
|
49
|
-
log.add(
|
51
|
+
log.add(
|
52
|
+
sys.stderr, level=level, backtrace=True, diagnose=True, colorize=True, format=format_str
|
53
|
+
)
|
50
54
|
log.info(f"micropython-stubber {__version__}")
|
51
55
|
return level
|
stubber/commands/clone_cmd.py
CHANGED
@@ -7,8 +7,8 @@ import os
|
|
7
7
|
from pathlib import Path
|
8
8
|
from typing import List, Tuple, Union
|
9
9
|
|
10
|
-
import click
|
11
|
-
import
|
10
|
+
import rich_click as click
|
11
|
+
import mpflash.basicgit as git
|
12
12
|
from loguru import logger as log
|
13
13
|
from stubber.utils.config import CONFIG
|
14
14
|
|
@@ -20,8 +20,20 @@ from .cli import stubber_cli
|
|
20
20
|
|
21
21
|
|
22
22
|
@stubber_cli.command(name="clone")
|
23
|
-
@click.option(
|
24
|
-
|
23
|
+
@click.option(
|
24
|
+
"--path",
|
25
|
+
"-p",
|
26
|
+
default=CONFIG.repo_path.as_posix(),
|
27
|
+
type=click.Path(file_okay=False, dir_okay=True),
|
28
|
+
)
|
29
|
+
@click.option(
|
30
|
+
"--stubs/--no-stubs",
|
31
|
+
"--add-stubs/--no-stubs",
|
32
|
+
"stubs",
|
33
|
+
default=False,
|
34
|
+
is_flag=True,
|
35
|
+
help="Also clone the micropython-stubs repo",
|
36
|
+
)
|
25
37
|
def cli_clone(path: Union[str, Path], stubs: bool = False):
|
26
38
|
"""
|
27
39
|
Clone/fetch the micropython repos locally.
|
stubber/commands/get_core_cmd.py
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
from pathlib import Path
|
8
8
|
from typing import List
|
9
9
|
|
10
|
-
import click
|
10
|
+
import rich_click as click
|
11
11
|
from loguru import logger as log
|
12
12
|
|
13
13
|
import stubber.get_cpython as get_cpython
|
@@ -54,14 +54,16 @@ def cli_get_core(
|
|
54
54
|
"""
|
55
55
|
# default parameter values
|
56
56
|
stub_folder = stub_folder or CONFIG.stub_path.as_posix()
|
57
|
-
|
57
|
+
|
58
58
|
stub_paths: List[Path] = []
|
59
59
|
for core_type in ["pycopy", "micropython"]:
|
60
60
|
log.info(f"::group:: Get Cpython core :{core_type}")
|
61
61
|
req_filename = f"requirements-core-{core_type}.txt"
|
62
62
|
stub_path = Path(stub_folder) / f"cpython_core-{core_type}"
|
63
63
|
|
64
|
-
get_cpython.get_core(
|
64
|
+
get_cpython.get_core(
|
65
|
+
stub_path=stub_path.as_posix(), requirements=req_filename, family=core_type
|
66
|
+
)
|
65
67
|
stub_paths.append(stub_path)
|
66
68
|
|
67
69
|
log.info("::group:: start post processing of retrieved stubs")
|
@@ -6,10 +6,10 @@ get-docstubs
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import Optional
|
8
8
|
|
9
|
-
import click
|
9
|
+
import rich_click as click
|
10
10
|
from loguru import logger as log
|
11
11
|
|
12
|
-
import
|
12
|
+
import mpflash.basicgit as git
|
13
13
|
import stubber.utils as utils
|
14
14
|
from stubber.stubs_from_docs import generate_from_rst
|
15
15
|
from stubber.utils.config import CONFIG
|
@@ -40,13 +40,15 @@ from .cli import stubber_cli
|
|
40
40
|
show_default=True,
|
41
41
|
)
|
42
42
|
# @click.option("--family", "-f", "basename", default="micropython", help="Micropython family.", show_default=True)
|
43
|
-
@click.option(
|
43
|
+
@click.option(
|
44
|
+
"--version", "--tag", default="", type=str, help="Version number to use. [default: Git tag]"
|
45
|
+
)
|
44
46
|
@click.option("--black/--no-black", "-b/-nb", default=True, help="Run black", show_default=True)
|
45
47
|
@click.pass_context
|
46
48
|
def cli_docstubs(
|
47
49
|
ctx: click.Context,
|
48
50
|
path: Optional[str] = None,
|
49
|
-
target:Optional[str] = None,
|
51
|
+
target: Optional[str] = None,
|
50
52
|
black: bool = True,
|
51
53
|
basename: Optional[str] = None,
|
52
54
|
version: str = "",
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import List, Optional
|
8
8
|
|
9
|
-
import click
|
9
|
+
import rich_click as click
|
10
10
|
from loguru import logger as log
|
11
11
|
|
12
12
|
import stubber.utils as utils
|
@@ -31,7 +31,7 @@ from .cli import stubber_cli
|
|
31
31
|
@click.option(
|
32
32
|
"--version",
|
33
33
|
"--Version",
|
34
|
-
"-
|
34
|
+
"-v",
|
35
35
|
"version",
|
36
36
|
default="",
|
37
37
|
# default=[CONFIG.stable_version],
|
@@ -85,7 +85,9 @@ def cli_get_frozen(
|
|
85
85
|
version = utils.checkedout_version(CONFIG.mpy_path)
|
86
86
|
log.info("MicroPython version : {}".format(version))
|
87
87
|
|
88
|
-
stub_path = freeze_any(
|
88
|
+
stub_path = freeze_any(
|
89
|
+
version=version, mpy_path=CONFIG.mpy_path, mpy_lib_path=CONFIG.mpy_lib_path
|
90
|
+
)
|
89
91
|
stub_paths.append(stub_path)
|
90
92
|
# Also enrich the frozen modules from the doc stubs if available
|
91
93
|
|