micropython-stubber 1.14.0__py3-none-any.whl → 1.14.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.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/METADATA +2 -2
- {micropython_stubber-1.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/RECORD +21 -21
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +1 -1
- stubber/board/createstubs_db.py +2 -2
- stubber/board/createstubs_db_min.py +1 -1
- stubber/board/createstubs_mem.py +2 -2
- stubber/board/createstubs_mem_min.py +1 -1
- stubber/board/createstubs_min.py +1 -1
- stubber/data/board_info.csv +1 -0
- stubber/data/board_info.json +8 -0
- stubber/minify.py +4 -1
- stubber/publish/merge_docstubs.py +6 -2
- stubber/publish/stubpacker.py +71 -27
- stubber/rst/lookup.py +22 -5
- stubber/rst/output_dict.py +12 -3
- stubber/rst/reader.py +1 -1
- stubber/utils/config.py +31 -8
- {micropython_stubber-1.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: micropython-stubber
|
3
|
-
Version: 1.14.
|
3
|
+
Version: 1.14.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
|
@@ -26,7 +26,7 @@ Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
26
26
|
Requires-Dist: esptool (>=4.4,<5.0) ; extra == "tools"
|
27
27
|
Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
|
28
28
|
Requires-Dist: libcst (>=0.4.9,<0.5.0)
|
29
|
-
Requires-Dist: loguru (>=0.6
|
29
|
+
Requires-Dist: loguru (>=0.6,<0.8)
|
30
30
|
Requires-Dist: mypy (==1.2.0)
|
31
31
|
Requires-Dist: packaging (>=21.3,<24.0)
|
32
32
|
Requires-Dist: pipx (>=1.1.0,<2.0.0)
|
@@ -1,19 +1,19 @@
|
|
1
|
-
stubber/__init__.py,sha256=
|
1
|
+
stubber/__init__.py,sha256=nunsyHrLLDdxrMp6ILZsR5CbHB9aTak-y0aGGyMMZpg,51
|
2
2
|
stubber/basicgit.py,sha256=uyfC_ZqfG5z8tIyBJV_8fZR8SWeuzx3X-p5juGHaGA4,9378
|
3
3
|
stubber/board/board_info.csv,sha256=e3xY-VTOh-iOmpGhhuADXnk3Rq-17ID0PJr8eKSH5Fw,7040
|
4
4
|
stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
|
5
|
-
stubber/board/createstubs.py,sha256=
|
6
|
-
stubber/board/createstubs_db.py,sha256=
|
7
|
-
stubber/board/createstubs_db_min.py,sha256=
|
5
|
+
stubber/board/createstubs.py,sha256=Y6mgjhENiSGY9Qai-j1kgaymV_XBaIe7gIeGxLM4GtA,30841
|
6
|
+
stubber/board/createstubs_db.py,sha256=2Ak9tzarhnRJU4jxF1pQBXFeMYoYOdnXQoXre8UeWvc,28351
|
7
|
+
stubber/board/createstubs_db_min.py,sha256=rIurAscBTwNEK2eb0WyhKpU3WHN2fSrKHqo1wrnfamI,10331
|
8
8
|
stubber/board/createstubs_db_mpy.mpy,sha256=DRm_ssNg4u6-iKA2EBh5b0At_6YiuC_a7vUPygM6YdI,8466
|
9
9
|
stubber/board/createstubs_info.py,sha256=jxj9sYalBJo5Wb73YGP83J_dqVFYk9KUtxa7p0kfFMo,30313
|
10
10
|
stubber/board/createstubs_lvgl.py,sha256=gnJI-N_A_HJ_Jzr-F-qX7gN_Y2AEm9MNg46LHsKuaKg,25560
|
11
11
|
stubber/board/createstubs_lvgl_min.py,sha256=_D-LtGRRPBC9gEwjpqBOgOEpfnoHn63szbh-lydCH74,9685
|
12
12
|
stubber/board/createstubs_lvgl_mpy.mpy,sha256=mWaMfbBI2UEw4r4Kq7SmynMPOiTC577-gJIPIzgR35Y,8002
|
13
|
-
stubber/board/createstubs_mem.py,sha256=
|
14
|
-
stubber/board/createstubs_mem_min.py,sha256=
|
13
|
+
stubber/board/createstubs_mem.py,sha256=YorlCSpRLQnaBieFSVjv7V4hCRazqHEd3C4N3xCyNyY,26219
|
14
|
+
stubber/board/createstubs_mem_min.py,sha256=ZA17xO6SVr7DPSOWkrc99XalkHA-ae-ipldQblXCa7o,9706
|
15
15
|
stubber/board/createstubs_mem_mpy.mpy,sha256=H71GSmt4LLDbSJ3pxafaDQ-EH6Tz2yzAcY5PJRsmzv4,7950
|
16
|
-
stubber/board/createstubs_min.py,sha256=
|
16
|
+
stubber/board/createstubs_min.py,sha256=O8KCrUkAli_ejXUo95ANIuoe8AVvm6pFbLB-1VamgnU,12065
|
17
17
|
stubber/board/createstubs_mpy.mpy,sha256=R2RsMkQ2LJroSqplaMM24mAGmPvwL13pyYsBlVjznaU,10821
|
18
18
|
stubber/board/logging.py,sha256=rdneoAwZg84uiWBJWYIp0gMcT2oU9Lu-1WIu1LqT_9w,2218
|
19
19
|
stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
|
@@ -50,8 +50,8 @@ stubber/commands/upd_fallback_cmd.py,sha256=5d6lIFa1mTo-2O-gDZKwHOZAo5bvX5mp4iaT
|
|
50
50
|
stubber/commands/upd_module_list_cmd.py,sha256=drtjqS2aMd0aM-JJdnyl4jcnbq135lfSVcgK_6eovBk,499
|
51
51
|
stubber/commands/variants_cmd.py,sha256=xCnR6vMQ-Q1zETn82reOhUQMQotXWt9y5dRBR7ewE2U,1313
|
52
52
|
stubber/cst_transformer.py,sha256=57ILkYBYWKQmq9Iz2VuP5_L4oksC9ofQVV4Gw-3veqU,6367
|
53
|
-
stubber/data/board_info.csv,sha256=
|
54
|
-
stubber/data/board_info.json,sha256=
|
53
|
+
stubber/data/board_info.csv,sha256=d64tfwmgkS491hgB4YN9kap7Tu7Hs4oUXxd-mHnXGyY,7120
|
54
|
+
stubber/data/board_info.json,sha256=7wwkNESVm_nSKwGIutS9nWPRdIkamGtXhivgF4ZNRLk,46684
|
55
55
|
stubber/data/micropython_tags.csv,sha256=HQnzPN7jLmgKX3QvobsPMZa-xMb0exglriFziBjaRz8,1909
|
56
56
|
stubber/data/requirements-core-micropython.txt,sha256=6RQWWbLh8YVcD_l1-hjg6wX_Fm1LmNEwy5NExKJIkeg,1317
|
57
57
|
stubber/data/requirements-core-pycopy.txt,sha256=tW71l6FIuoQY1tuxkDgeN4Uw8IIp0YrlhhaaqSGSOA8,1051
|
@@ -63,23 +63,23 @@ stubber/freeze/freeze_manifest_2.py,sha256=Vdrs2A5vvDDZ4WamcHG9sleKqNYGwIJ5yNQXp
|
|
63
63
|
stubber/freeze/get_frozen.py,sha256=5sU70m9HiTkbLCvTQMKDa13NLywijqThw6BuF3A71FE,4937
|
64
64
|
stubber/get_cpython.py,sha256=RYL3HHbNjaapT0JQZaLVd8wLSfm6RB6XpVELOae1z98,3782
|
65
65
|
stubber/get_lobo.py,sha256=jyysWbeEwNuZZtkTudJP1QbyVvh-TwFom5cE7iCi9lE,1776
|
66
|
-
stubber/minify.py,sha256=
|
66
|
+
stubber/minify.py,sha256=Pm2itd4Wugk3U15dBb5bnw13JRzYoNXueom3n_ZrUTw,13483
|
67
67
|
stubber/publish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
68
|
stubber/publish/bump.py,sha256=k69CID3nURPckyepABG-5u3U_VMiYADqZ2Oxl8x_zC0,3271
|
69
69
|
stubber/publish/candidates.py,sha256=3TbmrGL436Bx5PTf-cQ4C6j4p2MDR8ywefNIdoPR2wY,10684
|
70
70
|
stubber/publish/database.py,sha256=CLy5oiLasA-YzTTXi9d01qLAyk7NpugCDUOa5R9Ac2g,623
|
71
71
|
stubber/publish/enums.py,sha256=YI_0q3Iz3v1YqDuHgbuj7x6FBS5y5w3G1UdgpCGunNs,954
|
72
|
-
stubber/publish/merge_docstubs.py,sha256=
|
72
|
+
stubber/publish/merge_docstubs.py,sha256=O9kWJbW13mGJpupToI1M6VF7ofS7HDIVGdXLkFvIwok,6804
|
73
73
|
stubber/publish/missing_class_methods.py,sha256=8i4Znit5vOaGjuXlFn_BYBIEt7G45i0l0gbj1hWKgb8,1771
|
74
74
|
stubber/publish/package.py,sha256=ihhJrS2eqparkv1DfosSTivPqWoGlKKKOFnI8A5tbCg,6026
|
75
75
|
stubber/publish/publish.py,sha256=7hwaB4P04432XXQNRhV34NP5cwnkkrz2SUUSXnmjI5I,3518
|
76
76
|
stubber/publish/pypi.py,sha256=Mu1F7Xx4e0NPWK1_Erck6QGEfdY8w67EBeWFi6JiAzk,1240
|
77
|
-
stubber/publish/stubpacker.py,sha256=
|
77
|
+
stubber/publish/stubpacker.py,sha256=R4laCYbWcG7bN_gFSi6ViBJn3OZ6gxTJRPN1Dz-yfMQ,34964
|
78
78
|
stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
|
79
79
|
stubber/rst/classsort.py,sha256=YCmF4QEYXqZ1Yu2FZb1iPQBrVkq-mrZaBaRcSUlC7ZE,2655
|
80
|
-
stubber/rst/lookup.py,sha256=
|
81
|
-
stubber/rst/output_dict.py,sha256=
|
82
|
-
stubber/rst/reader.py,sha256=
|
80
|
+
stubber/rst/lookup.py,sha256=RZ-fm5kyHv-AEvAKauttvPMgGcPYlUActJyiZNDR-UE,20110
|
81
|
+
stubber/rst/output_dict.py,sha256=cpBXRtUD-uh0EgjWIBiRrMLBmIAEXjoJFSOAg-qJQiU,14755
|
82
|
+
stubber/rst/reader.py,sha256=B14fvWyx83JSH8oYMfQNWMM4kEqQUcY47FqQVasea78,32051
|
83
83
|
stubber/rst/report_return.py,sha256=WZJSbgjsjxFeCeY-vLms56gv_x3TubaGXGQ8--d8RqI,2814
|
84
84
|
stubber/rst/rst_utils.py,sha256=q4MCmhCeI0fnx6KNVdgz1nE4_hAK4T-F7oAMBnmwZ4w,17817
|
85
85
|
stubber/stubber.py,sha256=fPMqCT68AY8UEe2njlnbAU9vK87ZF3i7OAIJNCONsZY,1957
|
@@ -90,7 +90,7 @@ stubber/tools/readme.md,sha256=kH7dA2Rs4BLCXa2ILoTDIj3sJHcGYtDPntyxVIOXvtI,199
|
|
90
90
|
stubber/update_fallback.py,sha256=gRR-qxirz5uL0fALWJaI3PPb63_wIm-eETyB7paH0nk,4670
|
91
91
|
stubber/update_module_list.py,sha256=5l8yVwRaaMx6iQldk5AxBcqoVab7A4aE3SuO3duTrWg,4584
|
92
92
|
stubber/utils/__init__.py,sha256=tAmo9fjxIkMsmH4ZkgNB05zODEO_WjHDLXZFKk3SS3U,205
|
93
|
-
stubber/utils/config.py,sha256=
|
93
|
+
stubber/utils/config.py,sha256=H-QDGtjB90ezAU0Avfu5QBe65ANXvVcId03tnFv4Viw,4865
|
94
94
|
stubber/utils/makeversionhdr.py,sha256=ZRpClirIzNK4saZHPaDuEpXhBRI_Ow_yZOxeNM3D_Ro,1908
|
95
95
|
stubber/utils/manifest.py,sha256=XBYCkxtYVAdUcch1784eHPAXlXfyfjco4WnRXxBHZYA,3273
|
96
96
|
stubber/utils/post.py,sha256=Uq9HZn6hNZUABpQs7a7PM3zz0ncwzDJTqKbFKsywsDY,2662
|
@@ -99,8 +99,8 @@ stubber/utils/stubmaker.py,sha256=jX4DvPzgv3wWNnUVaXjpTitRNZZ9QbcvmnDsI0lshGc,43
|
|
99
99
|
stubber/utils/typed_config_toml.py,sha256=ikifCIZGNhS_uqsfp6IwIpxdtZqbLtywprjWG_Q0y8o,2629
|
100
100
|
stubber/utils/versions.py,sha256=_xSOwpJV0gAO-TK2KHu-Ze3m__739f1YUVIxiHE2vqY,1859
|
101
101
|
stubber/variants.py,sha256=Tm5PfHwKa_rrKAYWXtiNompqAJcD_DOV1B6lJD7L5Bg,3747
|
102
|
-
micropython_stubber-1.14.
|
103
|
-
micropython_stubber-1.14.
|
104
|
-
micropython_stubber-1.14.
|
105
|
-
micropython_stubber-1.14.
|
106
|
-
micropython_stubber-1.14.
|
102
|
+
micropython_stubber-1.14.1.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
|
103
|
+
micropython_stubber-1.14.1.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
|
104
|
+
micropython_stubber-1.14.1.dist-info/METADATA,sha256=Y9ZdKjlHGAH4dSVi5sX13gxM0Mgvyl5hX-M1vUh84aQ,16622
|
105
|
+
micropython_stubber-1.14.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
106
|
+
micropython_stubber-1.14.1.dist-info/RECORD,,
|
stubber/__init__.py
CHANGED
stubber/board/createstubs.py
CHANGED
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.14.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.14.1
|
22
22
|
"""
|
23
23
|
# Copyright (c) 2019-2023 Jos Verlinde
|
24
24
|
# pylint: disable= invalid-name, missing-function-docstring, import-outside-toplevel, logging-not-lazy
|
@@ -39,7 +39,7 @@ try:
|
|
39
39
|
except ImportError:
|
40
40
|
from ucollections import OrderedDict # type: ignore
|
41
41
|
|
42
|
-
__version__ = "v1.14.
|
42
|
+
__version__ = "v1.14.1"
|
43
43
|
ENOENT = 2
|
44
44
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
45
45
|
LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
|
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.14.
|
12
|
+
This variant was generated from createstubs.py by micropython-stubber v1.14.1
|
13
13
|
"""
|
14
14
|
# Copyright (c) 2019-2023 Jos Verlinde
|
15
15
|
# pylint: disable= invalid-name, missing-function-docstring, import-outside-toplevel, logging-not-lazy
|
@@ -30,7 +30,7 @@ try:
|
|
30
30
|
except ImportError:
|
31
31
|
from ucollections import OrderedDict # type: ignore
|
32
32
|
|
33
|
-
__version__ = "v1.14.
|
33
|
+
__version__ = "v1.14.1"
|
34
34
|
ENOENT = 2
|
35
35
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
36
36
|
LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
|
stubber/board/createstubs_min.py
CHANGED
stubber/data/board_info.csv
CHANGED
@@ -57,6 +57,7 @@ PCA10059 with NRF52840,PCA10059
|
|
57
57
|
PCA10090 with NRF9160,PCA10090
|
58
58
|
XIAO nRF52840 Sense with NRF52840,SEEED_XIAO_NRF52
|
59
59
|
WT51822-S4AT with NRF51822,WT51822_S4AT
|
60
|
+
PORTENTA C33 with RA6M5,ARDUINO_PORTENTA_C33
|
60
61
|
EK-RA4M1 with RA4M1,EK_RA4M1
|
61
62
|
EK-RA4W1 with RA4W1,EK_RA4W1
|
62
63
|
EK-RA6M1 with RA6M1,EK_RA6M1
|
stubber/data/board_info.json
CHANGED
@@ -463,6 +463,14 @@
|
|
463
463
|
"description": "WT51822-S4AT with NRF51822",
|
464
464
|
"path": "repos/micropython/ports/nrf/boards/WT51822_S4AT/mpconfigboard.h"
|
465
465
|
},
|
466
|
+
{
|
467
|
+
"port": "renesas-ra",
|
468
|
+
"board": "ARDUINO_PORTENTA_C33",
|
469
|
+
"board_name": "PORTENTA C33",
|
470
|
+
"mcu_name": "RA6M5",
|
471
|
+
"description": "PORTENTA C33 with RA6M5",
|
472
|
+
"path": "repos/micropython/ports/renesas-ra/boards/ARDUINO_PORTENTA_C33/mpconfigboard.h"
|
473
|
+
},
|
466
474
|
{
|
467
475
|
"port": "renesas-ra",
|
468
476
|
"board": "EK_RA4M1",
|
stubber/minify.py
CHANGED
@@ -229,6 +229,9 @@ def minify_script(source_script: StubSource, keep_report: bool = True, diff: boo
|
|
229
229
|
("rprint", 'self._log.info("Version: '),
|
230
230
|
("rprint", 'self._log.info("Port: '),
|
231
231
|
("rprint", 'self._log.info("Board: '),
|
232
|
+
# all others
|
233
|
+
("comment", 'self._log.'),
|
234
|
+
("comment", "_log ="),
|
232
235
|
]
|
233
236
|
else:
|
234
237
|
edits += [
|
@@ -304,7 +307,7 @@ def minify(
|
|
304
307
|
target = target / "minified.py" # or raise error?
|
305
308
|
target_buf = stack.enter_context(target.open("w+"))
|
306
309
|
elif isinstance(target, IOBase): # type: ignore
|
307
|
-
target_buf = target
|
310
|
+
target_buf = target
|
308
311
|
try:
|
309
312
|
minified = minify_script(source_script=source_buf, keep_report=keep_report, diff=diff)
|
310
313
|
target_buf.write(minified)
|
@@ -28,7 +28,9 @@ def get_base(candidate: Dict[str, str], version: Optional[str] = None):
|
|
28
28
|
def board_folder_name(fw: Dict, *, version: Optional[str] = None):
|
29
29
|
"""Return the name of the firmware folder. Can be in AnyCase."""
|
30
30
|
base = get_base(fw, version=version)
|
31
|
-
folder_name =
|
31
|
+
folder_name = (
|
32
|
+
f"{base}-{fw['port']}" if fw["board"] in GENERIC else f"{base}-{fw['port']}-{fw['board']}"
|
33
|
+
)
|
32
34
|
# do NOT force name to lowercase
|
33
35
|
# remove GENERIC Prefix
|
34
36
|
folder_name = folder_name.replace("-generic_", "-").replace("-GENERIC_", "-")
|
@@ -88,7 +90,7 @@ def merge_all_docstubs(
|
|
88
90
|
if candidate["version"] == "latest":
|
89
91
|
# for the latest we do a bit more effort to get something 'good enough'
|
90
92
|
# try to get the board_path from the last released version as the basis
|
91
|
-
board_path = CONFIG.stub_path / board_folder_name(candidate, version=
|
93
|
+
board_path = CONFIG.stub_path / board_folder_name(candidate, version="latest")
|
92
94
|
# check again
|
93
95
|
if board_path.exists():
|
94
96
|
log.info(f"using {board_path.name} as the basis for {merged_path.name}")
|
@@ -103,6 +105,7 @@ def merge_all_docstubs(
|
|
103
105
|
log.info(f"Merge docstubs for {merged_path.name} {candidate['version']}")
|
104
106
|
result = copy_and_merge_docstubs(board_path, merged_path, doc_path)
|
105
107
|
# Add methods from docstubs to the firmware stubs that do not exist in the firmware stubs
|
108
|
+
# Add the __call__ method to the machine.Pin and pyb.Pin class
|
106
109
|
add_machine_pin_call(merged_path, candidate["version"])
|
107
110
|
if result:
|
108
111
|
merged += 1
|
@@ -141,6 +144,7 @@ def copy_and_merge_docstubs(fw_path: Path, dest_path: Path, docstub_path: Path):
|
|
141
144
|
|
142
145
|
# avoid duplicate modules : folder - file combinations
|
143
146
|
# prefer folder from frozen stubs, over file from firmware stubs
|
147
|
+
# No frozen here - OLD code ?
|
144
148
|
for f in dest_path.glob("*"):
|
145
149
|
if f.is_dir():
|
146
150
|
for suffix in [".py", ".pyi"]:
|
stubber/publish/stubpacker.py
CHANGED
@@ -30,6 +30,15 @@ from stubber.utils.versions import clean_version
|
|
30
30
|
Status = NewType("Status", Dict[str, Union[str, None]])
|
31
31
|
StubSources = List[Tuple[StubSource, Path]]
|
32
32
|
|
33
|
+
# indicates which stubs will be skipped when copying for these stub sources
|
34
|
+
STUB_SKIPPER = {
|
35
|
+
StubSource.FROZEN: ["espnow"],
|
36
|
+
StubSource.FIRMWARE: ["builtins"],
|
37
|
+
StubSource.DOC: [],
|
38
|
+
StubSource.CORE: [],
|
39
|
+
|
40
|
+
}
|
41
|
+
|
33
42
|
|
34
43
|
class StubPackage:
|
35
44
|
"""
|
@@ -157,7 +166,9 @@ class StubPackage:
|
|
157
166
|
def update_pkg_version(self, production: bool) -> str:
|
158
167
|
"""Get the next version for the package"""
|
159
168
|
return (
|
160
|
-
self.get_prerelease_package_version(production)
|
169
|
+
self.get_prerelease_package_version(production)
|
170
|
+
if self.mpy_version == "latest"
|
171
|
+
else self.get_next_package_version(production)
|
161
172
|
)
|
162
173
|
|
163
174
|
def get_prerelease_package_version(self, production: bool = False) -> str:
|
@@ -165,9 +176,17 @@ class StubPackage:
|
|
165
176
|
rc = 1
|
166
177
|
if describe := get_git_describe(CONFIG.mpy_path.as_posix()):
|
167
178
|
# use versiontag and the nummer of commits since the last tag
|
168
|
-
|
169
|
-
|
179
|
+
# "v1.19.1-841-g3446"
|
180
|
+
# 'v1.22.0-preview-19-g8eb7721b4'
|
181
|
+
parts = describe.split("-", 3)
|
182
|
+
ver = parts[0]
|
183
|
+
rc = parts[1] if parts[1].isdigit() else parts[2] if parts[2].isdigit() else 1
|
170
184
|
rc = int(rc)
|
185
|
+
if parts[1] != "preview":
|
186
|
+
# old style - still need to guess the version
|
187
|
+
base = bump_version(Version(ver), minor_bump=True)
|
188
|
+
else:
|
189
|
+
base = Version(ver)
|
171
190
|
return str(bump_version(base, rc=rc))
|
172
191
|
else:
|
173
192
|
raise ValueError("cannot determine next version number micropython")
|
@@ -273,12 +292,12 @@ class StubPackage:
|
|
273
292
|
def update_sources(stub_sources: StubSources) -> StubSources:
|
274
293
|
"""
|
275
294
|
Update the stub sources to:
|
276
|
-
-
|
277
|
-
-
|
295
|
+
- FIRMWARE: prefer -merged stubs over bare firmware stubs
|
296
|
+
- FROZEN: fallback to use the GENERIC folder for the frozen sources if no board specific folder exists
|
278
297
|
"""
|
279
298
|
updated_sources = []
|
280
299
|
for stub_type, fw_path in stub_sources:
|
281
|
-
#
|
300
|
+
# prefer -merged stubs over bare firmwre stubs
|
282
301
|
if stub_type == StubSource.FIRMWARE:
|
283
302
|
# Check if -merged folder exists and use that instead
|
284
303
|
if fw_path.name.endswith("-merged"):
|
@@ -309,30 +328,29 @@ class StubPackage:
|
|
309
328
|
- 3 - remove *.py files from the package folder
|
310
329
|
"""
|
311
330
|
try:
|
312
|
-
# update to -
|
331
|
+
# update to -merged and fallback to GENERIC
|
313
332
|
self.stub_sources = self.update_sources(self.stub_sources)
|
314
333
|
# Check if all stub source folders exist
|
315
|
-
for stub_type,
|
316
|
-
if not (CONFIG.stub_path /
|
317
|
-
raise FileNotFoundError(
|
334
|
+
for stub_type, src_path in self.stub_sources:
|
335
|
+
if not (CONFIG.stub_path / src_path).exists():
|
336
|
+
raise FileNotFoundError(
|
337
|
+
f"Could not find stub source folder {CONFIG.stub_path / src_path}"
|
338
|
+
)
|
318
339
|
|
319
340
|
# 1 - Copy the stubs to the package, directly in the package folder (no folders)
|
320
341
|
# for stub_type, fw_path in [s for s in self.stub_sources]:
|
321
342
|
for n in range(len(self.stub_sources)):
|
322
|
-
stub_type,
|
343
|
+
stub_type, src_path = self.stub_sources[n]
|
323
344
|
try:
|
324
|
-
log.debug(f"Copying {stub_type} from {
|
325
|
-
|
326
|
-
CONFIG.stub_path / fw_path,
|
327
|
-
self.package_path,
|
328
|
-
symlinks=True,
|
329
|
-
dirs_exist_ok=True,
|
330
|
-
)
|
345
|
+
log.debug(f"Copying {stub_type} from {src_path}")
|
346
|
+
self.copy_folder(stub_type, src_path)
|
331
347
|
except OSError as e:
|
332
348
|
if stub_type != StubSource.FROZEN:
|
333
|
-
raise FileNotFoundError(
|
349
|
+
raise FileNotFoundError(
|
350
|
+
f"Could not find stub source folder {src_path}"
|
351
|
+
) from e
|
334
352
|
else:
|
335
|
-
log.debug(f"Error copying stubs from : {CONFIG.stub_path /
|
353
|
+
log.debug(f"Error copying stubs from : {CONFIG.stub_path / src_path}, {e}")
|
336
354
|
finally:
|
337
355
|
# 3 - clean up a little bit
|
338
356
|
# delete all the .py files in the package folder if there is a corresponding .pyi file
|
@@ -340,6 +358,19 @@ class StubPackage:
|
|
340
358
|
if f.with_suffix(".pyi").exists():
|
341
359
|
f.unlink()
|
342
360
|
|
361
|
+
def copy_folder(self, stub_type: StubSource, src_path: Path):
|
362
|
+
Path(self.package_path).mkdir(parents=True, exist_ok=True)
|
363
|
+
for item in (CONFIG.stub_path / src_path).rglob("*"):
|
364
|
+
if item.is_file():
|
365
|
+
# filter the 'poorly' decorated files
|
366
|
+
if stub_type in STUB_SKIPPER:
|
367
|
+
if item.stem in STUB_SKIPPER[stub_type]:
|
368
|
+
continue
|
369
|
+
|
370
|
+
target = Path(self.package_path) / item.relative_to(CONFIG.stub_path / src_path)
|
371
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
372
|
+
target.write_bytes(item.read_bytes())
|
373
|
+
|
343
374
|
def create_readme(self) -> None:
|
344
375
|
"""
|
345
376
|
Create a readme file for the package
|
@@ -444,7 +475,8 @@ class StubPackage:
|
|
444
475
|
_pyproject = self.pyproject
|
445
476
|
assert _pyproject is not None, "No pyproject.toml file found"
|
446
477
|
_pyproject["tool"]["poetry"]["packages"] = [
|
447
|
-
{"include": p.relative_to(self.package_path).as_posix()}
|
478
|
+
{"include": p.relative_to(self.package_path).as_posix()}
|
479
|
+
for p in sorted((self.package_path).rglob("*.pyi"))
|
448
480
|
]
|
449
481
|
# write out the pyproject.toml file
|
450
482
|
self.pyproject = _pyproject
|
@@ -631,7 +663,9 @@ class StubPackage:
|
|
631
663
|
# check if the sources exist
|
632
664
|
ok = self.are_package_sources_available()
|
633
665
|
if not ok:
|
634
|
-
log.debug(
|
666
|
+
log.debug(
|
667
|
+
f"{self.package_name}: skipping as one or more source stub folders are missing"
|
668
|
+
)
|
635
669
|
self.status["error"] = "Skipped, stub folder(s) missing"
|
636
670
|
shutil.rmtree(self.package_path.as_posix())
|
637
671
|
self._publish = False # type: ignore
|
@@ -650,7 +684,9 @@ class StubPackage:
|
|
650
684
|
self,
|
651
685
|
production: bool, # PyPI or Test-PyPi - USED TO FIND THE NEXT VERSION NUMBER
|
652
686
|
force=False, # BUILD even if no changes
|
653
|
-
) ->
|
687
|
+
) -> (
|
688
|
+
bool
|
689
|
+
): # sourcery skip: default-mutable-arg, extract-duplicate-method, require-parameter-annotation
|
654
690
|
"""
|
655
691
|
Build a package
|
656
692
|
look up the previous package version in the dabase
|
@@ -681,7 +717,9 @@ class StubPackage:
|
|
681
717
|
self.pkg_version = self.update_pkg_version(production)
|
682
718
|
self.status["version"] = self.pkg_version
|
683
719
|
# to get the next version
|
684
|
-
log.debug(
|
720
|
+
log.debug(
|
721
|
+
f"{self.package_name}: bump version for {old_ver} to {self.pkg_version } {'production' if production else 'test'}"
|
722
|
+
)
|
685
723
|
self.write_package_json()
|
686
724
|
log.trace(f"New hash: {self.package_name} {self.pkg_version} {self.hash}")
|
687
725
|
if self.poetry_build():
|
@@ -734,20 +772,26 @@ class StubPackage:
|
|
734
772
|
# Publish the package to PyPi, Test-PyPi or Github
|
735
773
|
if self.is_changed() or force:
|
736
774
|
if self.mpy_version == "latest":
|
737
|
-
log.warning(
|
775
|
+
log.warning(
|
776
|
+
"version: `latest` package will only be available on Github, and not published to PyPi."
|
777
|
+
)
|
738
778
|
self.status["result"] = "Published to GitHub"
|
739
779
|
else:
|
740
780
|
self.update_hashes() # resets is_changed to False
|
741
781
|
if not dry_run:
|
742
782
|
pub_ok = self.poetry_publish(production=production)
|
743
783
|
else:
|
744
|
-
log.warning(
|
784
|
+
log.warning(
|
785
|
+
f"{self.package_name}: Dry run, not publishing to {'' if production else 'Test-'}PyPi"
|
786
|
+
)
|
745
787
|
pub_ok = True
|
746
788
|
if not pub_ok:
|
747
789
|
log.warning(f"{self.package_name}: Publish failed for {self.pkg_version}")
|
748
790
|
self.status["error"] = "Publish failed"
|
749
791
|
return False
|
750
|
-
self.status["result"] =
|
792
|
+
self.status["result"] = (
|
793
|
+
"Published to PyPi" if production else "Published to Test-PyPi"
|
794
|
+
)
|
751
795
|
self.update_hashes()
|
752
796
|
if dry_run:
|
753
797
|
log.warning(f"{self.package_name}: Dry run, not saving to database")
|
stubber/rst/lookup.py
CHANGED
@@ -22,7 +22,7 @@ __all__ = [
|
|
22
22
|
|
23
23
|
# all possible Types needed for the stubs - exxess types should be removed later , and otherwise won't do much harm
|
24
24
|
TYPING_IMPORT: List[str] = [
|
25
|
-
"from typing import IO, Any, Callable, Coroutine, Dict, Generator, Iterator, List, NoReturn, Optional, Tuple, Union, NamedTuple, TypeVar",
|
25
|
+
"from typing import IO, Any, Callable, Coroutine, Dict, Generator, Iterator, List, NoReturn, Optional, Tuple, Union, NamedTuple, TypeVar, Iterator",
|
26
26
|
"from _typeshed import Incomplete",
|
27
27
|
]
|
28
28
|
|
@@ -158,7 +158,10 @@ LOOKUP_LIST = {
|
|
158
158
|
"uio.open": ("IO", 0.95), # Open a file.
|
159
159
|
"uos.listdir": ("List[Incomplete]", 0.95),
|
160
160
|
"os.uname": ("uname_result", 0.95),
|
161
|
-
"ssl.ssl.wrap_socket": (
|
161
|
+
"ssl.ssl.wrap_socket": (
|
162
|
+
"IO",
|
163
|
+
0.95,
|
164
|
+
), # undocumented class ssl.SSLSocket #TODO: or wrapped-socket object ?
|
162
165
|
"ussl.ussl.wrap_socket": ("IO", 0.95), # undocumented class ssl.SSLSocket
|
163
166
|
"usys.exit": ("NoReturn", 0.95), # never returns
|
164
167
|
"utime.sleep_ms": (
|
@@ -176,6 +179,8 @@ LOOKUP_LIST = {
|
|
176
179
|
"_onewire.writebyte": ("None", 0.95),
|
177
180
|
"_onewire.writebit": ("None", 0.95),
|
178
181
|
"_onewire.crc8": ("int", 0.95),
|
182
|
+
# espnow
|
183
|
+
"espnow.ESPNow.recv": ("List", 0.95), # list / ? tuple of bytestrings
|
179
184
|
}
|
180
185
|
|
181
186
|
|
@@ -464,8 +469,6 @@ PARAM_FIXES = [
|
|
464
469
|
),
|
465
470
|
# # This is a cleanup something that went wrong before
|
466
471
|
# Fix("**kwargs: Optional[Any]","**kwargs")
|
467
|
-
# ------ ESPNow.rst uses (ESP32 only) after the class / function prototype
|
468
|
-
Fix(r"\(ESP\d+\s+only\)", "", is_re=True), # ESP32 / ESP8266 Only
|
469
472
|
# os.mount - optional parameters
|
470
473
|
# fsobj, mount_point, *, readonly)
|
471
474
|
Fix(
|
@@ -473,7 +476,20 @@ PARAM_FIXES = [
|
|
473
476
|
"fsobj, mount_point, *, readonly=False)",
|
474
477
|
),
|
475
478
|
# micropython.const
|
476
|
-
Fix("expr)", "expr:Const_T)", name="const"), # const: 3 - paired with return typing
|
479
|
+
Fix("expr)", "expr:Const_T)", name="const"), # const: 3 - paired with return typing,
|
480
|
+
# ------ ESPNow.rst uses (ESP32 only) after the class / function prototype
|
481
|
+
Fix(r"\(ESP\d+\s+only\)", "", is_re=True), # ESP32 / ESP8266 Only
|
482
|
+
# espnow.ESPNow.send is missing several params
|
483
|
+
Fix(
|
484
|
+
"msg)",
|
485
|
+
"peer, msg,mac=None,sync=True)",
|
486
|
+
name="ESPNow.send",
|
487
|
+
),
|
488
|
+
Fix(
|
489
|
+
"msg)",
|
490
|
+
"peer, msg,mac=None,sync=True)",
|
491
|
+
name="ESPNow.asend",
|
492
|
+
),
|
477
493
|
]
|
478
494
|
|
479
495
|
# List of classes and their parent classes that should be added to the class definition
|
@@ -508,6 +524,7 @@ CHILD_PARENT_CLASS = {
|
|
508
524
|
"namedtuple": "tuple",
|
509
525
|
"deque": "stdlib_deque",
|
510
526
|
# ESPNow
|
527
|
+
"ESPNow": "ESPNowBase,Iterator",
|
511
528
|
"AIOESPNow": "ESPNow",
|
512
529
|
}
|
513
530
|
|
stubber/rst/output_dict.py
CHANGED
@@ -79,10 +79,11 @@ class SourceDict(OrderedDict):
|
|
79
79
|
out += str(code)
|
80
80
|
return out
|
81
81
|
|
82
|
-
def __add__(self,
|
82
|
+
def __add__(self, other: SourceDict):
|
83
|
+
"Aallows instances of the SourceDict class to be added together using the + operator or the += operator."
|
83
84
|
# sd = sd + function
|
84
85
|
# sd += function
|
85
|
-
self.update({
|
86
|
+
self.update({other.name: other})
|
86
87
|
return self
|
87
88
|
|
88
89
|
def add_docstr(self, docstr: Union[str, List[str]], extra: int = 0):
|
@@ -227,7 +228,15 @@ class SourceDict(OrderedDict):
|
|
227
228
|
|
228
229
|
class ModuleSourceDict(SourceDict):
|
229
230
|
def __init__(self, name: str, indent=0, lf: str = "\n"):
|
230
|
-
"
|
231
|
+
"""The ModuleSourceDict class is used to represent a Python module as a dictionary of its components,
|
232
|
+
such as its docstring, version, comments, imports, constants, classes, and functions.
|
233
|
+
The class has several methods,
|
234
|
+
sort() which sorts the components of the module in the correct order for a module definition to allow adding class variables,
|
235
|
+
find() which finds a class node based on its name,
|
236
|
+
classes() which returns a list of the class names in parent-child order,
|
237
|
+
add_import() which adds a list of imports to the module.
|
238
|
+
The __str__() method is also defined to return a string representation of the module.
|
239
|
+
"""
|
231
240
|
super().__init__(
|
232
241
|
[
|
233
242
|
("docstr", [EMPTY_DOCSTR]),
|
stubber/rst/reader.py
CHANGED
@@ -782,7 +782,7 @@ class RSTWriter(RSTParser):
|
|
782
782
|
return super().write_file(filename)
|
783
783
|
|
784
784
|
def prepare_output(self):
|
785
|
-
"
|
785
|
+
"Remove trailing spaces and commas from the output."
|
786
786
|
lines = str(self.output_dict).splitlines(keepends=True)
|
787
787
|
self.output = lines
|
788
788
|
for i in range(len(self.output)):
|
stubber/utils/config.py
CHANGED
@@ -16,7 +16,9 @@ class StubberConfig(Config):
|
|
16
16
|
stub_path = key(key_name="stub-path", cast=Path, required=False, default=Path("./stubs"))
|
17
17
|
"a Path to the stubs directory"
|
18
18
|
# relative to stubs folder
|
19
|
-
fallback_path = key(
|
19
|
+
fallback_path = key(
|
20
|
+
key_name="fallback-path", cast=Path, required=False, default=Path("typings/fallback")
|
21
|
+
)
|
20
22
|
"a Path to the fallback stubs directory"
|
21
23
|
|
22
24
|
# ------------------------------------------------------------------------------------------
|
@@ -27,23 +29,40 @@ class StubberConfig(Config):
|
|
27
29
|
mpy_path = key(key_name="mpy-path", cast=Path, required=False, default=Path("micropython"))
|
28
30
|
"a Path to the micropython folder in the repos directory"
|
29
31
|
|
30
|
-
mpy_lib_path = key(
|
32
|
+
mpy_lib_path = key(
|
33
|
+
key_name="mpy-lib-path", cast=Path, required=False, default=Path("micropython-lib")
|
34
|
+
)
|
31
35
|
"a Path to the micropython-lib folder in the repos directory"
|
32
36
|
|
33
37
|
# mpy_stubs_repo_path = key(key_name="mpy-stubs-repo-path", cast=Path, required=False, default=Path("./micropython-stubs"))
|
34
38
|
# "a Path to the micropython-stubs folder in the repos directory"
|
35
39
|
|
36
|
-
publish_path = key(
|
40
|
+
publish_path = key(
|
41
|
+
key_name="publish-path",
|
42
|
+
cast=Path,
|
43
|
+
required=False,
|
44
|
+
default=Path("./repos/micropython-stubs/publish"),
|
45
|
+
)
|
37
46
|
"a Path to the folder where all stub publication artefacts are stored"
|
38
47
|
|
39
|
-
template_path = key(
|
48
|
+
template_path = key(
|
49
|
+
key_name="template-path",
|
50
|
+
cast=Path,
|
51
|
+
required=False,
|
52
|
+
default=Path("./repos/micropython-stubs/publish/template"),
|
53
|
+
)
|
40
54
|
"a Path to the publication folder that has the template files"
|
41
55
|
|
42
56
|
stable_version = key(key_name="stable-version", cast=str, required=False, default="1.20.0")
|
43
57
|
|
44
58
|
"last published stable"
|
45
59
|
|
46
|
-
all_versions = key(
|
60
|
+
all_versions = key(
|
61
|
+
key_name="all-versions",
|
62
|
+
cast=list,
|
63
|
+
required=False,
|
64
|
+
default=["1.17", "1.18", "1.19", "1.19.1", "1.20.0"],
|
65
|
+
)
|
47
66
|
"list of recent versions"
|
48
67
|
|
49
68
|
BLOCKED_PORTS = ["minimal", "bare-arm"]
|
@@ -74,9 +93,11 @@ class StubberConfig(Config):
|
|
74
93
|
all_versions = git.get_tags("micropython/micropython", minver="v1.17")
|
75
94
|
except Exception as e:
|
76
95
|
log.warning(f"Could not read micropython versions from git: {e}")
|
77
|
-
all_versions = ["1.
|
96
|
+
all_versions = ["1.19", "1.19.1", "1.20.0", "1.21.0"]
|
78
97
|
config_updates.update(all_versions=all_versions)
|
79
|
-
config_updates.update(
|
98
|
+
config_updates.update(
|
99
|
+
stable_version=[v for v in all_versions if not v.endswith("preview")][-1]
|
100
|
+
) # second last version - last version is the preview version
|
80
101
|
return config_updates
|
81
102
|
|
82
103
|
|
@@ -98,7 +119,9 @@ def readconfig(filename: str = "pyproject.toml", prefix: str = "tool.", must_exi
|
|
98
119
|
# add provider sources to the config
|
99
120
|
config.add_source(EnvironmentConfigSource())
|
100
121
|
if use_toml:
|
101
|
-
config.add_source(
|
122
|
+
config.add_source(
|
123
|
+
TomlConfigSource(filename, prefix=prefix, must_exist=must_exist)
|
124
|
+
) # ,"tools.micropython-stubber"))
|
102
125
|
config.read()
|
103
126
|
return config
|
104
127
|
|
File without changes
|
File without changes
|
{micropython_stubber-1.14.0.dist-info → micropython_stubber-1.14.1.dist-info}/entry_points.txt
RENAMED
File without changes
|