micropython-stubber 1.19.0__py3-none-any.whl → 1.20.0__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 (32) hide show
  1. {micropython_stubber-1.19.0.dist-info → micropython_stubber-1.20.0.dist-info}/METADATA +1 -1
  2. {micropython_stubber-1.19.0.dist-info → micropython_stubber-1.20.0.dist-info}/RECORD +28 -32
  3. mpflash/mpflash/cli_flash.py +9 -4
  4. mpflash/mpflash/cli_group.py +1 -1
  5. mpflash/mpflash/flash_uf2.py +1 -1
  6. mpflash/mpflash/list.py +27 -11
  7. mpflash/mpflash/mpremoteboard/__init__.py +6 -5
  8. mpflash/mpflash/worklist.py +1 -1
  9. mpflash/poetry.lock +84 -83
  10. mpflash/pyproject.toml +1 -1
  11. stubber/__init__.py +1 -1
  12. stubber/board/createstubs.py +2 -1
  13. stubber/board/createstubs_db.py +2 -2
  14. stubber/board/createstubs_db_min.py +1 -1
  15. stubber/board/createstubs_db_mpy.mpy +0 -0
  16. stubber/board/createstubs_mem.py +2 -2
  17. stubber/board/createstubs_mem_min.py +1 -1
  18. stubber/board/createstubs_mem_mpy.mpy +0 -0
  19. stubber/board/createstubs_min.py +2 -2
  20. stubber/board/createstubs_mpy.mpy +0 -0
  21. stubber/board/modulelist.txt +1 -0
  22. stubber/commands/{mcu_cmd.py → get_mcu_cmd.py} +20 -3
  23. stubber/stubber.py +1 -9
  24. stubber/update_fallback.py +104 -104
  25. stubber/utils/config.py +6 -0
  26. stubber/commands/get_lobo_cmd.py +0 -58
  27. stubber/commands/minify_cmd.py +0 -60
  28. stubber/commands/upd_fallback_cmd.py +0 -36
  29. stubber/commands/upd_module_list_cmd.py +0 -18
  30. {micropython_stubber-1.19.0.dist-info → micropython_stubber-1.20.0.dist-info}/LICENSE +0 -0
  31. {micropython_stubber-1.19.0.dist-info → micropython_stubber-1.20.0.dist-info}/WHEEL +0 -0
  32. {micropython_stubber-1.19.0.dist-info → micropython_stubber-1.20.0.dist-info}/entry_points.txt +0 -0
stubber/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """get the version"""
2
2
 
3
- __version__ = "1.19.0"
3
+ __version__ = "1.20.0"
@@ -24,7 +24,7 @@ try:
24
24
  except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
- __version__ = "v1.19.0"
27
+ __version__ = "v1.20.0"
28
28
  ENOENT = 2
29
29
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
30
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -951,6 +951,7 @@ def main():
951
951
  "uwebsocket",
952
952
  "uzlib",
953
953
  "version",
954
+ "vfs",
954
955
  "websocket",
955
956
  "websocket_helper",
956
957
  "wipy",
@@ -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.19.0
21
+ This variant was generated from createstubs.py by micropython-stubber v1.20.0
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.19.0"
46
+ __version__ = "v1.20.0"
47
47
  ENOENT = 2
48
48
  _MAX_CLASS_LEVEL = 2 # Max class nesting
49
49
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -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.19.0'
54
+ __version__='v1.20.0'
55
55
  A3=2
56
56
  A4=2
57
57
  A5=['lib','/lib','/sd/lib','/flash/lib',J]
Binary file
@@ -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.19.0
12
+ This variant was generated from createstubs.py by micropython-stubber v1.20.0
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.19.0"
37
+ __version__ = "v1.20.0"
38
38
  ENOENT = 2
39
39
  _MAX_CLASS_LEVEL = 2 # Max class nesting
40
40
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -47,7 +47,7 @@ try:from machine import reset
47
47
  except N:pass
48
48
  try:from collections import OrderedDict as g
49
49
  except N:from ucollections import OrderedDict as g
50
- __version__='v1.19.0'
50
+ __version__='v1.20.0'
51
51
  y=2
52
52
  z=2
53
53
  A0=['lib','/lib','/sd/lib','/flash/lib',J]
Binary file
@@ -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.19.0'
53
+ __version__='v1.20.0'
54
54
  A0=2
55
55
  A1=2
56
56
  A5=['lib','/lib','/sd/lib','/flash/lib',J]
@@ -287,7 +287,7 @@ def read_path():
287
287
  def j():
288
288
  try:A=bytes('abc',encoding='utf8');B=j.__module__;return H
289
289
  except(k,I):return U
290
- def main():stubber=Stubber(path=read_path());stubber.clean();stubber.modules=['WM8960','_OTA','_asyncio','_boot_fat','_coap','_espnow','_flash_control_OTA','_main_pybytes','_mqtt','_mqtt_core','_msg_handl','_onewire','_periodical_pin','_pybytes','_pybytes_ca','_pybytes_config','_pybytes_config_reader','_pybytes_connection','_pybytes_constants','_pybytes_debug','_pybytes_library','_pybytes_machine_learning','_pybytes_main','_pybytes_protocol','_pybytes_pyconfig','_pybytes_pymesh_config','_rp2','_terminal','_thread','_uasyncio','_urequest','adcfft','aioble/__init__','aioble/central','aioble/client','aioble/core','aioble/device','aioble/l2cap','aioble/peripheral','aioble/security','aioble/server','aioespnow','ak8963','apa102','apa106','argparse','array','asyncio/__init__','asyncio/core','asyncio/event','asyncio/funcs','asyncio/lock','asyncio/stream','binascii','bluetooth','breakout_as7262','breakout_bh1745','breakout_bme280','breakout_bme68x','breakout_bmp280','breakout_dotmatrix','breakout_encoder','breakout_icp10125','breakout_ioexpander','breakout_ltr559','breakout_matrix11x7','breakout_mics6814','breakout_msa301','breakout_paa5100','breakout_pmw3901','breakout_potentiometer','breakout_rgbmatrix5x5','breakout_rtc','breakout_scd41','breakout_sgp30','breakout_trackball','breakout_vl53l5cx','btree','cmath','collections','crypto','cryptolib','curl','deflate','dht','display','display_driver_utils','ds18x20','encoder','errno','esp','esp32','espidf','espnow','ffi','flashbdev','framebuf','freesans20','fs_driver','functools','galactic','gc','gfx_pack','gsm','hashlib','heapq','hub75','ili9341','ili9XXX','imagetools','inisetup','interstate75','io','jpegdec','json','lcd160cr','lodepng',w,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',b,'mip','mip/__init__','mip/__main__','motor','mpu6500','mpu9250','neopixel','network','ntptime','onewire','os','pcf85063a','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform','pyb',g,'pye','qrcode','queue','random','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',v,'termios','time','tpcalib','uarray','uasyncio/__init__','uasyncio/core','uasyncio/event','uasyncio/funcs','uasyncio/lock','uasyncio/stream','uasyncio/tasks','ubinascii','ubluetooth','ucollections','ucrypto','ucryptolib','uctypes','uerrno','uftpd','uhashlib','uheapq','uio','ujson','ulab','ulab/approx','ulab/compare','ulab/fft','ulab/filter','ulab/linalg','ulab/numerical','ulab/poly','ulab/user','ulab/vector','umachine','umqtt/__init__','umqtt/robust','umqtt/simple','uos','uplatform','uqueue','urandom','ure','urequests','urllib/urequest','uselect','usocket','ussl','ustruct','usys','utelnetserver','utime','utimeq','uwebsocket','uzlib',C,'websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];F.collect();stubber.create_all_stubs()
290
+ def main():stubber=Stubber(path=read_path());stubber.clean();stubber.modules=['WM8960','_OTA','_asyncio','_boot_fat','_coap','_espnow','_flash_control_OTA','_main_pybytes','_mqtt','_mqtt_core','_msg_handl','_onewire','_periodical_pin','_pybytes','_pybytes_ca','_pybytes_config','_pybytes_config_reader','_pybytes_connection','_pybytes_constants','_pybytes_debug','_pybytes_library','_pybytes_machine_learning','_pybytes_main','_pybytes_protocol','_pybytes_pyconfig','_pybytes_pymesh_config','_rp2','_terminal','_thread','_uasyncio','_urequest','adcfft','aioble/__init__','aioble/central','aioble/client','aioble/core','aioble/device','aioble/l2cap','aioble/peripheral','aioble/security','aioble/server','aioespnow','ak8963','apa102','apa106','argparse','array','asyncio/__init__','asyncio/core','asyncio/event','asyncio/funcs','asyncio/lock','asyncio/stream','binascii','bluetooth','breakout_as7262','breakout_bh1745','breakout_bme280','breakout_bme68x','breakout_bmp280','breakout_dotmatrix','breakout_encoder','breakout_icp10125','breakout_ioexpander','breakout_ltr559','breakout_matrix11x7','breakout_mics6814','breakout_msa301','breakout_paa5100','breakout_pmw3901','breakout_potentiometer','breakout_rgbmatrix5x5','breakout_rtc','breakout_scd41','breakout_sgp30','breakout_trackball','breakout_vl53l5cx','btree','cmath','collections','crypto','cryptolib','curl','deflate','dht','display','display_driver_utils','ds18x20','encoder','errno','esp','esp32','espidf','espnow','ffi','flashbdev','framebuf','freesans20','fs_driver','functools','galactic','gc','gfx_pack','gsm','hashlib','heapq','hub75','ili9341','ili9XXX','imagetools','inisetup','interstate75','io','jpegdec','json','lcd160cr','lodepng',w,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',b,'mip','mip/__init__','mip/__main__','motor','mpu6500','mpu9250','neopixel','network','ntptime','onewire','os','pcf85063a','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform','pyb',g,'pye','qrcode','queue','random','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',v,'termios','time','tpcalib','uarray','uasyncio/__init__','uasyncio/core','uasyncio/event','uasyncio/funcs','uasyncio/lock','uasyncio/stream','uasyncio/tasks','ubinascii','ubluetooth','ucollections','ucrypto','ucryptolib','uctypes','uerrno','uftpd','uhashlib','uheapq','uio','ujson','ulab','ulab/approx','ulab/compare','ulab/fft','ulab/filter','ulab/linalg','ulab/numerical','ulab/poly','ulab/user','ulab/vector','umachine','umqtt/__init__','umqtt/robust','umqtt/simple','uos','uplatform','uqueue','urandom','ure','urequests','urllib/urequest','uselect','usocket','ussl','ustruct','usys','utelnetserver','utime','utimeq','uwebsocket','uzlib',C,'vfs','websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];F.collect();stubber.create_all_stubs()
291
291
  if __name__=='__main__'or j():
292
292
  if not A4('no_auto_stubber.txt'):
293
293
  try:F.threshold(4*1024);F.enable()
Binary file
@@ -226,6 +226,7 @@ utimeq
226
226
  uwebsocket
227
227
  uzlib
228
228
  version
229
+ vfs
229
230
  websocket
230
231
  websocket_helper
231
232
  wipy
@@ -1,12 +1,16 @@
1
1
  """Deploy and run createstubs on one or more microcontrollers."""
2
+
2
3
  ##########################################################################################
3
4
  # stub
4
5
  ##########################################################################################
5
6
 
6
7
 
7
8
  import click
9
+ from loguru import logger as log
8
10
 
9
11
  from stubber.bulk.mcu_stubber import stub_connected_mcus
12
+ from stubber.utils.config import CONFIG
13
+
10
14
  from .cli import stubber_cli
11
15
 
12
16
  ##########################################################################################
@@ -32,8 +36,21 @@ from .cli import stubber_cli
32
36
  help="Python source or pre-compiled.",
33
37
  )
34
38
  @click.option("--debug/--no-debug", default=False, show_default=True, help="Debug mode.")
35
- @click.option("--reset/--no-reset", default=False, show_default=True, help="Reset the board before running createstubs.")
36
- @click.option("--github/--local", default=True, show_default=True, help="where to install the board files from. local is intended for development.")
37
- def cli_create_mcu_stubs(variant: str, format: str, debug: bool, reset:bool, github:bool) -> int:
39
+ @click.option(
40
+ "--reset/--no-reset", default=False, show_default=True, help="Reset the board before running createstubs."
41
+ )
42
+ @click.option(
43
+ "--github/--local",
44
+ default=True,
45
+ show_default=True,
46
+ help="where to install the board files from. local is intended for development.",
47
+ )
48
+ def cli_create_mcu_stubs(variant: str, format: str, debug: bool, reset: bool, github: bool) -> int:
38
49
  """Run createstubs on one or more MCUs, and add the stubs to the micropython-stub repo."""
50
+ # check if all repos have been cloned
51
+ for repo in CONFIG.repos:
52
+ if not repo.exists():
53
+ log.error(f"Repo {repo} not found, use 'stubber clone --add-stubs' to clone the repos.")
54
+ exit(1)
55
+
39
56
  exit(stub_connected_mcus(variant=variant, format=format, debug=debug))
stubber/stubber.py CHANGED
@@ -12,16 +12,12 @@ from stubber.commands.enrich_folder_cmd import cli_enrich_folder
12
12
  from stubber.commands.get_core_cmd import cli_get_core
13
13
  from stubber.commands.get_docstubs_cmd import cli_docstubs
14
14
  from stubber.commands.get_frozen_cmd import cli_get_frozen
15
- # from stubber.commands.get_lobo_cmd import cli_get_lobo
16
15
  from stubber.commands.merge_cmd import cli_merge_docstubs
17
- # from stubber.commands.minify_cmd import cli_minify
18
16
  from stubber.commands.publish_cmd import cli_publish
19
17
  from stubber.commands.stub_cmd import cli_stub
20
18
  from stubber.commands.switch_cmd import cli_switch
21
- # from stubber.commands.upd_fallback_cmd import cli_update_fallback
22
- # from stubber.commands.upd_module_list_cmd import cli_update_module_list
23
19
  from stubber.commands.variants_cmd import cli_variants
24
- from stubber.commands.mcu_cmd import cli_create_mcu_stubs
20
+ from stubber.commands.get_mcu_cmd import cli_create_mcu_stubs
25
21
 
26
22
  ##########################################################################################
27
23
  if __name__ == "__main__":
@@ -33,14 +29,10 @@ if __name__ == "__main__":
33
29
  stubber_cli.add_command(cli_docstubs)
34
30
  stubber_cli.add_command(cli_get_core)
35
31
  stubber_cli.add_command(cli_get_frozen)
36
- # stubber_cli.add_command(cli_get_lobo)
37
32
  stubber_cli.add_command(cli_stub)
38
33
  stubber_cli.add_command(cli_enrich_folder)
39
- # stubber_cli.add_command(cli_minify)
40
34
  stubber_cli.add_command(cli_publish)
41
35
  stubber_cli.add_command(cli_merge_docstubs)
42
- # stubber_cli.add_command(cli_update_module_list)
43
- # stubber_cli.add_command(cli_update_fallback)
44
36
  stubber_cli.add_command(cli_variants)
45
37
  stubber_cli.add_command(cli_create_mcu_stubs)
46
38
  stubber_cli()
@@ -1,117 +1,117 @@
1
- """build/update the fallback 'catch-all' stubfolder"""
1
+ # """build/update the fallback 'catch-all' stubfolder"""
2
2
 
3
- import os
4
- import shutil
5
- from distutils.dir_util import copy_tree
6
- from distutils.errors import DistutilsFileError
7
- from pathlib import Path
8
- from typing import List, Optional, Tuple
3
+ # import os
4
+ # import shutil
5
+ # from distutils.dir_util import copy_tree
6
+ # from distutils.errors import DistutilsFileError
7
+ # from pathlib import Path
8
+ # from typing import List, Optional, Tuple
9
9
 
10
- from loguru import logger as log
10
+ # from loguru import logger as log
11
11
 
12
- from stubber.utils.versions import V_PREVIEW
12
+ # from stubber.utils.versions import V_PREVIEW
13
13
 
14
- # log = logging.getLogger()
14
+ # # log = logging.getLogger()
15
15
 
16
- RELEASED = "v1_18"
16
+ # RELEASED = "v1_18"
17
17
 
18
18
 
19
- def fallback_sources(version: str, fw_version: Optional[str] = None) -> List[Tuple[str, str]]:
20
- # sourcery skip: inline-immediately-returned-variable
21
- """
22
- list of sources to build/update the fallback 'catch-all' stubfolder
23
- version : the version to use
24
- fw_version : version to source the MCU stubs from. Defaults to the version used , but can be lower
19
+ # def fallback_sources(version: str, fw_version: Optional[str] = None) -> List[Tuple[str, str]]:
20
+ # # sourcery skip: inline-immediately-returned-variable
21
+ # """
22
+ # list of sources to build/update the fallback 'catch-all' stubfolder
23
+ # version : the version to use
24
+ # fw_version : version to source the MCU stubs from. Defaults to the version used , but can be lower
25
25
 
26
- """
27
- if not fw_version:
28
- fw_version = version
29
- if fw_version == V_PREVIEW:
30
- fw_version = RELEASED
31
- SOURCES = [
32
- ("uasyncio", f"micropython-{fw_version}-esp32"),
33
- ("umqtt", f"micropython-{fw_version}-esp32"),
34
- ("_onewire.py*", f"micropython-{fw_version}-esp32"),
35
- ("_uasyncio.py*", f"micropython-{fw_version}-esp32"),
36
- ("array.py*", f"micropython-{fw_version}-esp32"),
37
- ("binascii.py*", f"micropython-{fw_version}-esp32"),
38
- ("hashlib.py*", f"micropython-{fw_version}-esp32"),
39
- ("machine.py*", f"micropython-{fw_version}-esp32"),
40
- ("micropython.py*", f"micropython-{version}-docstubs"), # esp32"),
41
- ("network.pyi", f"micropython-{version}-docstubs"), # esp32"),
42
- ("struct.py*", f"micropython-{fw_version}-esp32"),
43
- ("uarray.py*", f"micropython-{fw_version}-esp32"),
44
- ("ubinascii.py*", f"micropython-{fw_version}-esp32"),
45
- ("uctypes.py*", f"micropython-{fw_version}-esp32"),
46
- ("uerrno.py*", f"micropython-{fw_version}-esp32"),
47
- ("uhashlib.py*", f"micropython-{fw_version}-esp32"),
48
- ("uio.py*", f"micropython-{fw_version}-esp32"),
49
- ("ujson.py*", f"micropython-{fw_version}-esp32"),
50
- ("uselect.py*", f"micropython-{fw_version}-esp32"),
51
- ("usocket.py*", f"micropython-{fw_version}-esp32"),
52
- ("ussl.py*", f"micropython-{fw_version}-esp32"),
53
- ("ustruct.py*", f"micropython-{fw_version}-esp32"),
54
- ("sys.py*", f"micropython-{fw_version}-esp32"),
55
- ("usys.py*", f"micropython-{fw_version}-esp32"),
56
- ("uzlib.py*", f"micropython-{fw_version}-esp32"),
57
- ("bluetooth.py*", f"micropython-{version}-docstubs"),
58
- # esp
59
- ("esp.py*", f"micropython-{version}-docstubs"), # 8266 fw stub has most functions
60
- ("esp32.py*", f"micropython-{version}-docstubs"), # esp32"),
61
- # pyboard == stm32
62
- ("pyb.py*", f"micropython-{fw_version}-stm32"),
63
- ("framebuf.py*", f"micropython-{fw_version}-stm32"),
64
- # rp2
65
- ("_rp2.py*", f"micropython-{fw_version}-rp2"),
66
- # stdlib
67
- ("os.py*", f"micropython-{fw_version}-esp32"), # -> stdlib
68
- ("uos.py*", f"micropython-{fw_version}-esp32"),
69
- ("time.py*", f"micropython-{fw_version}-esp32"), # -> stdlib
70
- ("utime.py*", f"micropython-{fw_version}-esp32"),
71
- ]
72
- return SOURCES
26
+ # """
27
+ # if not fw_version:
28
+ # fw_version = version
29
+ # if fw_version == V_PREVIEW:
30
+ # fw_version = RELEASED
31
+ # SOURCES = [
32
+ # ("uasyncio", f"micropython-{fw_version}-esp32"),
33
+ # ("umqtt", f"micropython-{fw_version}-esp32"),
34
+ # ("_onewire.py*", f"micropython-{fw_version}-esp32"),
35
+ # ("_uasyncio.py*", f"micropython-{fw_version}-esp32"),
36
+ # ("array.py*", f"micropython-{fw_version}-esp32"),
37
+ # ("binascii.py*", f"micropython-{fw_version}-esp32"),
38
+ # ("hashlib.py*", f"micropython-{fw_version}-esp32"),
39
+ # ("machine.py*", f"micropython-{fw_version}-esp32"),
40
+ # ("micropython.py*", f"micropython-{version}-docstubs"), # esp32"),
41
+ # ("network.pyi", f"micropython-{version}-docstubs"), # esp32"),
42
+ # ("struct.py*", f"micropython-{fw_version}-esp32"),
43
+ # ("uarray.py*", f"micropython-{fw_version}-esp32"),
44
+ # ("ubinascii.py*", f"micropython-{fw_version}-esp32"),
45
+ # ("uctypes.py*", f"micropython-{fw_version}-esp32"),
46
+ # ("uerrno.py*", f"micropython-{fw_version}-esp32"),
47
+ # ("uhashlib.py*", f"micropython-{fw_version}-esp32"),
48
+ # ("uio.py*", f"micropython-{fw_version}-esp32"),
49
+ # ("ujson.py*", f"micropython-{fw_version}-esp32"),
50
+ # ("uselect.py*", f"micropython-{fw_version}-esp32"),
51
+ # ("usocket.py*", f"micropython-{fw_version}-esp32"),
52
+ # ("ussl.py*", f"micropython-{fw_version}-esp32"),
53
+ # ("ustruct.py*", f"micropython-{fw_version}-esp32"),
54
+ # ("sys.py*", f"micropython-{fw_version}-esp32"),
55
+ # ("usys.py*", f"micropython-{fw_version}-esp32"),
56
+ # ("uzlib.py*", f"micropython-{fw_version}-esp32"),
57
+ # ("bluetooth.py*", f"micropython-{version}-docstubs"),
58
+ # # esp
59
+ # ("esp.py*", f"micropython-{version}-docstubs"), # 8266 fw stub has most functions
60
+ # ("esp32.py*", f"micropython-{version}-docstubs"), # esp32"),
61
+ # # pyboard == stm32
62
+ # ("pyb.py*", f"micropython-{fw_version}-stm32"),
63
+ # ("framebuf.py*", f"micropython-{fw_version}-stm32"),
64
+ # # rp2
65
+ # ("_rp2.py*", f"micropython-{fw_version}-rp2"),
66
+ # # stdlib
67
+ # ("os.py*", f"micropython-{fw_version}-esp32"), # -> stdlib
68
+ # ("uos.py*", f"micropython-{fw_version}-esp32"),
69
+ # ("time.py*", f"micropython-{fw_version}-esp32"), # -> stdlib
70
+ # ("utime.py*", f"micropython-{fw_version}-esp32"),
71
+ # ]
72
+ # return SOURCES
73
73
 
74
74
 
75
- def update_fallback(stubpath: Path, fallback_path: Path, version: str = RELEASED):
76
- "update the fallback stubs from the defined sources"
77
- # remove all *.py/.pyi files
78
- if not fallback_path.exists():
79
- os.makedirs(fallback_path)
80
- else:
81
- oldstubs = list(fallback_path.rglob("*.py")) + list(fallback_path.rglob("*.pyi"))
82
- log.debug(f"deleting {len(oldstubs)} stubs from {fallback_path.as_posix()}")
83
- for f in oldstubs:
84
- try:
85
- os.remove(f)
86
- except OSError as e:
87
- log.warning(e)
88
- added = 0
89
- for name, source in fallback_sources(version):
90
- if "." not in name:
91
- # copy folder
92
- log.debug(f"add {source} folder")
93
- try:
94
- copy_tree(
95
- (stubpath / source / name).as_posix(),
96
- (fallback_path / name).as_posix(),
97
- )
98
- added += 1
99
- except DistutilsFileError:
100
- log.warning(f"{(stubpath / source / name).as_posix()} not found")
101
- else:
102
- # copy file(s)
103
- log.debug(f"add {source}")
104
- for f in (stubpath / source).glob(name):
105
- shutil.copyfile(f, fallback_path / f.name)
106
- added += 1
107
- return added
75
+ # def update_fallback(stubpath: Path, fallback_path: Path, version: str = RELEASED):
76
+ # "update the fallback stubs from the defined sources"
77
+ # # remove all *.py/.pyi files
78
+ # if not fallback_path.exists():
79
+ # os.makedirs(fallback_path)
80
+ # else:
81
+ # oldstubs = list(fallback_path.rglob("*.py")) + list(fallback_path.rglob("*.pyi"))
82
+ # log.debug(f"deleting {len(oldstubs)} stubs from {fallback_path.as_posix()}")
83
+ # for f in oldstubs:
84
+ # try:
85
+ # os.remove(f)
86
+ # except OSError as e:
87
+ # log.warning(e)
88
+ # added = 0
89
+ # for name, source in fallback_sources(version):
90
+ # if "." not in name:
91
+ # # copy folder
92
+ # log.debug(f"add {source} folder")
93
+ # try:
94
+ # copy_tree(
95
+ # (stubpath / source / name).as_posix(),
96
+ # (fallback_path / name).as_posix(),
97
+ # )
98
+ # added += 1
99
+ # except DistutilsFileError:
100
+ # log.warning(f"{(stubpath / source / name).as_posix()} not found")
101
+ # else:
102
+ # # copy file(s)
103
+ # log.debug(f"add {source}")
104
+ # for f in (stubpath / source).glob(name):
105
+ # shutil.copyfile(f, fallback_path / f.name)
106
+ # added += 1
107
+ # return added
108
108
 
109
109
 
110
- if __name__ == "__main__":
111
- from stubber.utils.config import CONFIG
110
+ # if __name__ == "__main__":
111
+ # from stubber.utils.config import CONFIG
112
112
 
113
- update_fallback(
114
- CONFIG.stub_path,
115
- CONFIG.fallback_path,
116
- version=RELEASED,
117
- )
113
+ # update_fallback(
114
+ # CONFIG.stub_path,
115
+ # CONFIG.fallback_path,
116
+ # version=RELEASED,
117
+ # )
stubber/utils/config.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """stubber configuration"""
2
2
 
3
3
  from pathlib import Path
4
+ from typing import List
4
5
 
5
6
  from loguru import logger as log
6
7
  from typedconfig.config import Config, key, section
@@ -48,6 +49,11 @@ class StubberConfig(Config):
48
49
  BLOCKED_PORTS = ["minimal", "bare-arm"]
49
50
  "ports that should be ignored as a source of stubs"
50
51
 
52
+ @property
53
+ def repos(self) -> List[Path]:
54
+ "return the repo paths"
55
+ return [self.mpy_path, self.mpy_lib_path, self.mpy_stubs_path]
56
+
51
57
  @property
52
58
  def stub_path(self) -> Path:
53
59
  "return the stubs path in the microypthon-stubs repo"
@@ -1,58 +0,0 @@
1
- """
2
- get-lobo (frozen)
3
- """
4
-
5
- from pathlib import Path
6
- from typing import List
7
-
8
- import click
9
- import stubber.get_lobo as get_lobo
10
- import stubber.utils as utils
11
- from loguru import logger as log
12
- from stubber.commands.cli import stubber_cli
13
- from stubber.utils.config import CONFIG
14
-
15
-
16
- @stubber_cli.command(name="get-lobo")
17
- @click.option(
18
- "--stub-folder",
19
- "-stubs",
20
- default=CONFIG.stub_path.as_posix(),
21
- type=click.Path(exists=True, file_okay=False, dir_okay=True),
22
- show_default=True,
23
- )
24
- @click.option(
25
- "--pyi/--no-pyi",
26
- default=True,
27
- help="Create .pyi files for the (new) frozen modules",
28
- show_default=True,
29
- )
30
- @click.option(
31
- "--black/--no-black",
32
- default=True,
33
- help="Run black on the (new) frozen modules",
34
- show_default=True,
35
- )
36
- def cli_get_lobo(
37
- stub_folder: str = CONFIG.stub_path.as_posix(),
38
- pyi: bool = True,
39
- black: bool = True,
40
- ):
41
- """
42
- Get the frozen stubs for Lobo-esp32.
43
-
44
- """
45
- log.info("Get the frozen modules Loboris v3.2.24")
46
-
47
- stub_paths: List[Path] = []
48
-
49
- family = "loboris"
50
- version = "v3.2.24"
51
- stub_path = Path(stub_folder) / f"{family}-{utils.clean_version(version, flat=True)}-frozen"
52
- stub_paths.append(stub_path)
53
- get_lobo.get_frozen(stub_path)
54
- stub_paths = [stub_path]
55
-
56
- log.info("::group:: start post processing of retrieved stubs")
57
- utils.do_post_processing(stub_paths, stubgen=pyi, black=black, autoflake=True)
58
- log.info("::group:: Done")
@@ -1,60 +0,0 @@
1
- """Minify createstubs*.py."""
2
- ##########################################################################################
3
- # minify
4
- ##########################################################################################
5
- from pathlib import Path
6
- from typing import Union
7
-
8
- import click
9
- from loguru import logger as log
10
- from stubber.minify import minify, cross_compile
11
- import stubber
12
-
13
- from .cli import stubber_cli
14
-
15
-
16
- @stubber_cli.command(name="minify")
17
- @click.option("--source", "-s", default="createstubs.py", type=click.Path(file_okay=True, dir_okay=False), show_default=True)
18
- @click.option("--diff", "-d", help="Show the functional changes made to the source script.", default=False, is_flag=True)
19
- @click.option("--compile", "-c", "-xc", "compile", help="Cross compile after minification.", default=False, is_flag=True)
20
- @click.option("--all", "-a", help="Minify all variants (normal, _mem and _db).", default=False, is_flag=True)
21
- @click.option(
22
- "--report/--no-report",
23
- "keep_report",
24
- help="Keep or disable minimal progress reporting in the minified version.",
25
- default=True,
26
- show_default=True,
27
- )
28
- @click.pass_context
29
- def cli_minify(
30
- ctx: click.Context,
31
- source: Union[str, Path],
32
- keep_report: bool,
33
- diff: bool,
34
- compile: bool,
35
- all: bool,
36
- ) -> int:
37
- """
38
- Minify createstubs*.py.
39
-
40
- Creates a minified version of the SOURCE micropython file in TARGET (file or folder).
41
- The goal is to use less memory / not to run out of memory, while generating MCU stubs.
42
- """
43
- if all:
44
- sources = ["createstubs.py", "createstubs_mem.py", "createstubs_db.py"]
45
- else:
46
- sources = [source]
47
- log.trace(f"sources: {sources}")
48
- for source in sources:
49
- # TODO: Check if module resources should not be retrieved via API (e.g. via importlib.resources)
50
- src = Path(stubber.__file__).parent / "board" / source
51
- dst = src.with_name(src.stem + "_min.py")
52
- min_dest = src.with_name(src.stem + "_mpy.mpy")
53
- log.info(f"\nMinifying {src}...")
54
- minify(src, dst, keep_report, diff)
55
- if compile:
56
- log.info("Cross compiling...")
57
- cross_compile(dst, min_dest)
58
-
59
- log.info("Done!")
60
- return 0
@@ -1,36 +0,0 @@
1
- """
2
- update-fallback folder with common set of stubs that cater for most of the devices
3
- """
4
-
5
- import click
6
- from pathlib import Path
7
- from stubber.update_fallback import update_fallback, RELEASED
8
- from stubber.utils.config import CONFIG
9
-
10
- from .cli import stubber_cli
11
-
12
-
13
- @stubber_cli.command(name="update-fallback")
14
- @click.option("--version", default=RELEASED, type=str, help="Version number to use", show_default=True)
15
- @click.option(
16
- "--stub-folder",
17
- default=CONFIG.stub_path.as_posix(),
18
- type=click.Path(exists=True, file_okay=False, dir_okay=True),
19
- help="Destination of the files to be generated.",
20
- show_default=True,
21
- )
22
- def cli_update_fallback(
23
- version: str,
24
- stub_folder: str = CONFIG.stub_path.as_posix(),
25
- ):
26
- """
27
- Update the fallback stubs.
28
-
29
- The fallback stubs are updated/collated from files of the firmware-stubs, doc-stubs and core-stubs.
30
- """
31
- stub_path = Path(stub_folder)
32
- update_fallback(
33
- stub_path,
34
- CONFIG.fallback_path,
35
- version=version,
36
- )
@@ -1,18 +0,0 @@
1
- """
2
- update-fallback folder with common set of stubs that cater for most of the devices
3
- """
4
-
5
- from stubber.update_module_list import update_module_list as update_module_list
6
-
7
- from .cli import stubber_cli
8
-
9
-
10
- @stubber_cli.command(
11
- name="update-module-list",
12
- help="Update the module list based on the information in the data folder",
13
- )
14
- def cli_update_module_list():
15
- """
16
- Update the module list based on the information in the data folder.
17
- """
18
- update_module_list()