micropython-stubber 1.20.0__py3-none-any.whl → 1.20.2__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 (60) hide show
  1. {micropython_stubber-1.20.0.dist-info → micropython_stubber-1.20.2.dist-info}/METADATA +6 -6
  2. {micropython_stubber-1.20.0.dist-info → micropython_stubber-1.20.2.dist-info}/RECORD +58 -51
  3. mpflash/README.md +54 -35
  4. mpflash/libusb_flash.ipynb +203 -203
  5. mpflash/mpflash/add_firmware.py +98 -0
  6. mpflash/mpflash/ask_input.py +106 -114
  7. mpflash/mpflash/cli_download.py +58 -37
  8. mpflash/mpflash/cli_flash.py +77 -35
  9. mpflash/mpflash/cli_group.py +14 -12
  10. mpflash/mpflash/cli_list.py +40 -4
  11. mpflash/mpflash/cli_main.py +20 -8
  12. mpflash/mpflash/common.py +125 -12
  13. mpflash/mpflash/config.py +2 -0
  14. mpflash/mpflash/connected.py +74 -0
  15. mpflash/mpflash/download.py +67 -50
  16. mpflash/mpflash/downloaded.py +9 -9
  17. mpflash/mpflash/flash.py +2 -2
  18. mpflash/mpflash/flash_esp.py +2 -2
  19. mpflash/mpflash/flash_uf2.py +16 -8
  20. mpflash/mpflash/flash_uf2_linux.py +5 -16
  21. mpflash/mpflash/flash_uf2_macos.py +78 -0
  22. mpflash/mpflash/flash_uf2_windows.py +1 -1
  23. mpflash/mpflash/list.py +58 -57
  24. mpflash/mpflash/mpboard_id/__init__.py +37 -44
  25. mpflash/mpflash/mpboard_id/add_boards.py +255 -0
  26. mpflash/mpflash/mpboard_id/board.py +37 -0
  27. mpflash/mpflash/mpboard_id/board_id.py +50 -43
  28. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  29. mpflash/mpflash/mpboard_id/store.py +42 -0
  30. mpflash/mpflash/mpremoteboard/__init__.py +18 -6
  31. mpflash/mpflash/mpremoteboard/runner.py +12 -12
  32. mpflash/mpflash/uf2disk.py +12 -0
  33. mpflash/mpflash/vendor/basicgit.py +288 -0
  34. mpflash/mpflash/vendor/dfu.py +1 -0
  35. mpflash/mpflash/vendor/versions.py +7 -3
  36. mpflash/mpflash/worklist.py +71 -48
  37. mpflash/poetry.lock +163 -137
  38. mpflash/pyproject.toml +18 -15
  39. stubber/__init__.py +1 -1
  40. stubber/board/createstubs.py +4 -3
  41. stubber/board/createstubs_db.py +5 -7
  42. stubber/board/createstubs_db_min.py +1 -1
  43. stubber/board/createstubs_db_mpy.mpy +0 -0
  44. stubber/board/createstubs_mem.py +6 -7
  45. stubber/board/createstubs_mem_min.py +1 -1
  46. stubber/board/createstubs_mem_mpy.mpy +0 -0
  47. stubber/board/createstubs_min.py +2 -2
  48. stubber/board/createstubs_mpy.mpy +0 -0
  49. stubber/board/modulelist.txt +1 -0
  50. stubber/commands/get_core_cmd.py +7 -6
  51. stubber/commands/get_docstubs_cmd.py +8 -3
  52. stubber/commands/get_frozen_cmd.py +5 -2
  53. stubber/publish/publish.py +18 -7
  54. stubber/utils/makeversionhdr.py +3 -2
  55. stubber/utils/versions.py +2 -1
  56. mpflash/mpflash/mpboard_id/board_info.csv +0 -2213
  57. mpflash/mpflash/mpboard_id/board_info.json +0 -19910
  58. {micropython_stubber-1.20.0.dist-info → micropython_stubber-1.20.2.dist-info}/LICENSE +0 -0
  59. {micropython_stubber-1.20.0.dist-info → micropython_stubber-1.20.2.dist-info}/WHEEL +0 -0
  60. {micropython_stubber-1.20.0.dist-info → micropython_stubber-1.20.2.dist-info}/entry_points.txt +0 -0
@@ -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.20.0
21
+ This variant was generated from createstubs.py by micropython-stubber v1.20.2
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.20.0"
46
+ __version__ = "v1.20.2"
47
47
  ENOENT = 2
48
48
  _MAX_CLASS_LEVEL = 2 # Max class nesting
49
49
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -557,9 +557,7 @@ def _info(): # type:() -> dict[str, str]
557
557
  info["mpy"] = (
558
558
  sys.implementation._mpy # type: ignore
559
559
  if "_mpy" in dir(sys.implementation)
560
- else sys.implementation.mpy
561
- if "mpy" in dir(sys.implementation)
562
- else "" # type: ignore
560
+ else sys.implementation.mpy if "mpy" in dir(sys.implementation) else "" # type: ignore
563
561
  )
564
562
  except (AttributeError, IndexError):
565
563
  pass
@@ -609,10 +607,10 @@ def _info(): # type:() -> dict[str, str]
609
607
  if (
610
608
  info["version"]
611
609
  and info["version"].endswith(".0")
612
- and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
610
+ and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.2 do not have a micro .0
613
611
  and info["version"] <= "1.19.9"
614
612
  ):
615
- # versions from 1.10.0 to 1.20.0 do not have a micro .0
613
+ # versions from 1.10.0 to 1.20.2 do not have a micro .0
616
614
  info["version"] = info["version"][:-2]
617
615
 
618
616
  # 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.20.0'
54
+ __version__='v1.20.2'
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.20.0
12
+ This variant was generated from createstubs.py by micropython-stubber v1.20.2
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.20.0"
37
+ __version__ = "v1.20.2"
38
38
  ENOENT = 2
39
39
  _MAX_CLASS_LEVEL = 2 # Max class nesting
40
40
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -548,9 +548,7 @@ def _info(): # type:() -> dict[str, str]
548
548
  info["mpy"] = (
549
549
  sys.implementation._mpy # type: ignore
550
550
  if "_mpy" in dir(sys.implementation)
551
- else sys.implementation.mpy
552
- if "mpy" in dir(sys.implementation)
553
- else "" # type: ignore
551
+ else sys.implementation.mpy if "mpy" in dir(sys.implementation) else "" # type: ignore
554
552
  )
555
553
  except (AttributeError, IndexError):
556
554
  pass
@@ -600,10 +598,10 @@ def _info(): # type:() -> dict[str, str]
600
598
  if (
601
599
  info["version"]
602
600
  and info["version"].endswith(".0")
603
- and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
601
+ and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.2 do not have a micro .0
604
602
  and info["version"] <= "1.19.9"
605
603
  ):
606
- # versions from 1.10.0 to 1.20.0 do not have a micro .0
604
+ # versions from 1.10.0 to 1.20.2 do not have a micro .0
607
605
  info["version"] = info["version"][:-2]
608
606
 
609
607
  # spell-checker: disable
@@ -723,6 +721,7 @@ def main():
723
721
  # Option: Specify a firmware name & version
724
722
  # stubber = Stubber(firmware_id='HoverBot v1.2.1')
725
723
  stubber.clean()
724
+
726
725
  # Read stubs from modulelist in the current folder or in /libs
727
726
  # fall back to default modules
728
727
  def get_modulelist(stubber):
@@ -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.20.0'
50
+ __version__='v1.20.2'
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.20.0'
53
+ __version__='v1.20.2'
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,'vfs','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','tls','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
@@ -173,6 +173,7 @@ struct
173
173
  sys
174
174
  termios
175
175
  time
176
+ tls
176
177
  tpcalib
177
178
  uarray
178
179
  uasyncio/__init__
@@ -4,11 +4,12 @@
4
4
  # core
5
5
  ##########################################################################################
6
6
 
7
- from loguru import logger as log
8
7
  from pathlib import Path
9
8
  from typing import List
10
9
 
11
10
  import click
11
+ from loguru import logger as log
12
+
12
13
  import stubber.get_cpython as get_cpython
13
14
  import stubber.utils as utils
14
15
  from stubber.utils.config import CONFIG
@@ -41,7 +42,7 @@ from .cli import stubber_cli
41
42
  show_default=True,
42
43
  )
43
44
  def cli_get_core(
44
- stub_folder: str = CONFIG.stub_path.as_posix(),
45
+ stub_folder: str = "",
45
46
  # core_type: str = "pycopy", # pycopy or Micropython CPython stubs
46
47
  stubgen: bool = True,
47
48
  black: bool = True,
@@ -51,16 +52,16 @@ def cli_get_core(
51
52
 
52
53
  Get the core (CPython compat) modules for both MicroPython and Pycopy.
53
54
  """
54
-
55
+ # default parameter values
56
+ stub_folder = stub_folder or CONFIG.stub_path.as_posix()
57
+
55
58
  stub_paths: List[Path] = []
56
59
  for core_type in ["pycopy", "micropython"]:
57
60
  log.info(f"::group:: Get Cpython core :{core_type}")
58
61
  req_filename = f"requirements-core-{core_type}.txt"
59
62
  stub_path = Path(stub_folder) / f"cpython_core-{core_type}"
60
63
 
61
- get_cpython.get_core(
62
- stub_path=stub_path.as_posix(), requirements=req_filename, family=core_type
63
- )
64
+ get_cpython.get_core(stub_path=stub_path.as_posix(), requirements=req_filename, family=core_type)
64
65
  stub_paths.append(stub_path)
65
66
 
66
67
  log.info("::group:: start post processing of retrieved stubs")
@@ -4,6 +4,7 @@ get-docstubs
4
4
  """
5
5
 
6
6
  from pathlib import Path
7
+ from typing import Optional
7
8
 
8
9
  import click
9
10
  from loguru import logger as log
@@ -44,10 +45,10 @@ from .cli import stubber_cli
44
45
  @click.pass_context
45
46
  def cli_docstubs(
46
47
  ctx: click.Context,
47
- path: str = CONFIG.repo_path.as_posix(),
48
- target: str = CONFIG.stub_path.as_posix(),
48
+ path: Optional[str] = None,
49
+ target:Optional[str] = None,
49
50
  black: bool = True,
50
- basename: str = "micropython",
51
+ basename: Optional[str] = None,
51
52
  version: str = "",
52
53
  ):
53
54
  """
@@ -55,6 +56,10 @@ def cli_docstubs(
55
56
 
56
57
  Read the Micropython library documentation files and use them to build stubs that can be used for static typechecking.
57
58
  """
59
+ # default parameter values
60
+ path = path or CONFIG.repo_path.as_posix()
61
+ target = target or CONFIG.stub_path.as_posix()
62
+ basename = basename or "micropython"
58
63
 
59
64
  if path == CONFIG.repo_path.as_posix():
60
65
  # default
@@ -4,7 +4,7 @@
4
4
  # get-frozen
5
5
  ##########################################################################################
6
6
  from pathlib import Path
7
- from typing import List
7
+ from typing import List, Optional
8
8
 
9
9
  import click
10
10
  from loguru import logger as log
@@ -51,7 +51,7 @@ from .cli import stubber_cli
51
51
  show_default=True,
52
52
  )
53
53
  def cli_get_frozen(
54
- stub_folder: str = CONFIG.stub_path.as_posix(),
54
+ stub_folder: Optional[str] = None,
55
55
  # path: str = config.repo_path.as_posix(),
56
56
  version: str = "",
57
57
  stubgen: bool = True,
@@ -63,6 +63,9 @@ def cli_get_frozen(
63
63
 
64
64
  Get the frozen modules for the checked out version of MicroPython
65
65
  """
66
+ # default parameter values
67
+ stub_folder = stub_folder or CONFIG.stub_path.as_posix()
68
+ # FIXME: Stub_folder is not used
66
69
 
67
70
  stub_paths: List[Path] = []
68
71
 
@@ -3,7 +3,8 @@ prepare a set of stub files for publishing to PyPi
3
3
 
4
4
  !!Note: anything excluded in .gitignore is not packaged by poetry
5
5
  """
6
- from typing import Any, Dict, List, Union
6
+
7
+ from typing import Any, Dict, List, Optional, Union
7
8
 
8
9
  from loguru import logger as log
9
10
 
@@ -18,9 +19,9 @@ from stubber.utils.versions import V_PREVIEW
18
19
 
19
20
  def build_multiple(
20
21
  family: str = "micropython",
21
- versions: List[str] = [V_PREVIEW],
22
- ports: List[str] = ["all"],
23
- boards: List[str] = [GENERIC_U],
22
+ versions: Optional[List[str]] = None,
23
+ ports: Optional[List[str]] = None,
24
+ boards: Optional[List[str]] = None,
24
25
  production: bool = False,
25
26
  clean: bool = False,
26
27
  force: bool = False,
@@ -28,6 +29,11 @@ def build_multiple(
28
29
  """
29
30
  Build a bunch of stub packages
30
31
  """
32
+ # default parameter values
33
+ versions = versions or [V_PREVIEW]
34
+ ports = ports or ["all"]
35
+ boards = boards or [GENERIC_U]
36
+
31
37
  db = get_database(CONFIG.publish_path, production=production)
32
38
  results: List[Dict[str, Any]] = []
33
39
  worklist = build_worklist(family, versions, ports, boards)
@@ -47,9 +53,9 @@ def build_multiple(
47
53
 
48
54
  def publish_multiple(
49
55
  family: str = "micropython",
50
- versions: List[str] = ["v1.19.1"],
51
- ports: List[str] = ["all"],
52
- boards: List[str] = [GENERIC_U],
56
+ versions: Optional[List[str]] = None,
57
+ ports: Optional[List[str]] = None,
58
+ boards: Optional[List[str]] = None,
53
59
  production: bool = False,
54
60
  clean: bool = False,
55
61
  build: bool = False,
@@ -59,6 +65,11 @@ def publish_multiple(
59
65
  """
60
66
  Publish a bunch of stub packages
61
67
  """
68
+ # default parameter values
69
+ versions = versions or [V_PREVIEW]
70
+ ports = ports or ["all"]
71
+ boards = boards or [GENERIC_U]
72
+
62
73
  db = get_database(CONFIG.publish_path, production=production)
63
74
  results = []
64
75
  worklist = build_worklist(family, versions, ports, boards)
@@ -6,14 +6,15 @@ from __future__ import print_function
6
6
 
7
7
  import subprocess
8
8
  from pathlib import Path
9
- from typing import Tuple, Union
9
+ from typing import Optional, Tuple, Union
10
10
 
11
11
 
12
- def get_version_info_from_git(path: Path = Path.cwd()) -> Tuple[Union[str, None], Union[str, None]]:
12
+ def get_version_info_from_git(path: Optional[Path] = None) -> Tuple[Union[str, None], Union[str, None]]:
13
13
  """return the version info from the git repository specified.
14
14
  returns: a 2-tuple containing git_tag, short_hash
15
15
 
16
16
  """
17
+ path = path or Path.cwd()
17
18
  # Note: git describe doesn't work if no tag is available
18
19
  try:
19
20
  git_tag = subprocess.check_output(
stubber/utils/versions.py CHANGED
@@ -82,9 +82,10 @@ def micropython_versions(minver: str = "v1.9.2"):
82
82
  """Get the list of micropython versions from github tags"""
83
83
  try:
84
84
  g = Github()
85
- _ = 1 / 0
86
85
  repo = g.get_repo("micropython/micropython")
87
86
  versions = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
87
+ # Only keep the last preview
88
+ versions = [v for v in versions if not v.endswith(V_PREVIEW) or v == versions[-1]]
88
89
  except Exception:
89
90
  versions = [
90
91
  "v9.99.9-preview",