micropython-stubber 1.20.1__py3-none-any.whl → 1.20.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/METADATA +4 -3
  2. {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/RECORD +58 -51
  3. {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/WHEEL +1 -1
  4. mpflash/README.md +16 -5
  5. mpflash/mpflash/add_firmware.py +98 -0
  6. mpflash/mpflash/ask_input.py +97 -120
  7. mpflash/mpflash/cli_download.py +42 -25
  8. mpflash/mpflash/cli_flash.py +70 -32
  9. mpflash/mpflash/cli_group.py +17 -14
  10. mpflash/mpflash/cli_list.py +39 -3
  11. mpflash/mpflash/cli_main.py +17 -6
  12. mpflash/mpflash/common.py +125 -12
  13. mpflash/mpflash/config.py +12 -0
  14. mpflash/mpflash/connected.py +74 -0
  15. mpflash/mpflash/download.py +132 -51
  16. mpflash/mpflash/downloaded.py +36 -15
  17. mpflash/mpflash/flash.py +2 -2
  18. mpflash/mpflash/flash_esp.py +2 -2
  19. mpflash/mpflash/flash_uf2.py +14 -8
  20. mpflash/mpflash/flash_uf2_boardid.py +2 -1
  21. mpflash/mpflash/flash_uf2_linux.py +5 -16
  22. mpflash/mpflash/flash_uf2_macos.py +37 -0
  23. mpflash/mpflash/flash_uf2_windows.py +5 -5
  24. mpflash/mpflash/list.py +57 -57
  25. mpflash/mpflash/mpboard_id/__init__.py +41 -44
  26. mpflash/mpflash/mpboard_id/add_boards.py +255 -0
  27. mpflash/mpflash/mpboard_id/board.py +37 -0
  28. mpflash/mpflash/mpboard_id/board_id.py +54 -34
  29. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  30. mpflash/mpflash/mpboard_id/store.py +43 -0
  31. mpflash/mpflash/mpremoteboard/__init__.py +18 -6
  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 +164 -138
  38. mpflash/pyproject.toml +18 -15
  39. stubber/__init__.py +1 -1
  40. stubber/board/createstubs.py +13 -3
  41. stubber/board/createstubs_db.py +5 -7
  42. stubber/board/createstubs_db_min.py +329 -825
  43. stubber/board/createstubs_db_mpy.mpy +0 -0
  44. stubber/board/createstubs_mem.py +6 -7
  45. stubber/board/createstubs_mem_min.py +304 -765
  46. stubber/board/createstubs_mem_mpy.mpy +0 -0
  47. stubber/board/createstubs_min.py +293 -975
  48. stubber/board/createstubs_mpy.mpy +0 -0
  49. stubber/board/modulelist.txt +10 -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/update_module_list.py +2 -24
  55. stubber/utils/makeversionhdr.py +3 -2
  56. stubber/utils/versions.py +2 -1
  57. mpflash/mpflash/mpboard_id/board_info.csv +0 -2213
  58. mpflash/mpflash/mpboard_id/board_info.json +0 -19910
  59. {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/LICENSE +0 -0
  60. {micropython_stubber-1.20.1.dist-info → micropython_stubber-1.20.4.dist-info}/entry_points.txt +0 -0
Binary file
@@ -113,6 +113,8 @@ inisetup
113
113
  interstate75
114
114
  io
115
115
  jpegdec
116
+ js
117
+ jsffi
116
118
  json
117
119
  lcd160cr
118
120
  lodepng
@@ -138,6 +140,7 @@ neopixel
138
140
  network
139
141
  ntptime
140
142
  onewire
143
+ openamp
141
144
  os
142
145
  pcf85063a
143
146
  picoexplorer
@@ -173,6 +176,7 @@ struct
173
176
  sys
174
177
  termios
175
178
  time
179
+ tls
176
180
  tpcalib
177
181
  uarray
178
182
  uasyncio/__init__
@@ -215,6 +219,12 @@ urandom
215
219
  ure
216
220
  urequests
217
221
  urllib/urequest
222
+ usb/device
223
+ usb/device/cdc
224
+ usb/device/hid
225
+ usb/device/keyboard
226
+ usb/device/midi
227
+ usb/device/mouse
218
228
  uselect
219
229
  usocket
220
230
  ussl
@@ -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)
@@ -12,8 +12,6 @@ for this :
12
12
  - board/createstubs.py
13
13
 
14
14
  - TODO: remove the frozen modules from this list
15
- - TODO: bump patch number if there are actual changes
16
-
17
15
  """
18
16
 
19
17
  from pathlib import Path
@@ -32,7 +30,7 @@ def read_modules(path: Optional[Path] = None) -> Set[str]:
32
30
  """
33
31
  path = Path(path or "./data")
34
32
  assert path
35
- all_modules = set()
33
+ all_modules: Set[str] = set()
36
34
  for file in path.glob("*.txt"):
37
35
  log.debug(f"processing: {file.name}")
38
36
  with file.open("r") as f:
@@ -45,27 +43,7 @@ def read_modules(path: Optional[Path] = None) -> Set[str]:
45
43
  file_mods = [m for m in file_mods if not m.endswith("_test")]
46
44
  all_modules = set(all_modules | set(file_mods))
47
45
  log.trace(">" * 40)
48
-
49
- return all_modules
50
-
51
-
52
- # def wrapped(modules: Union[Set, List]) -> str:
53
- # "wrap code line at spaces"
54
- # long_line = str(modules)
55
- # _wrapped = " self.modules = "
56
- # IDENT = len(_wrapped)
57
- # MAX_WIDTH = 135
58
-
59
- # # find seperator
60
- # while len(long_line) > MAX_WIDTH:
61
- # p1 = long_line.find("', ", MAX_WIDTH)
62
- # # drop space
63
- # p1 += 3
64
- # short = long_line[0 : p1 - 1]
65
- # _wrapped += short + "\n" + " " * IDENT
66
- # long_line = long_line[p1 - 1 :]
67
- # _wrapped += long_line
68
- # return _wrapped
46
+ return {m.replace(".", "/") for m in all_modules}
69
47
 
70
48
 
71
49
  def update_module_list():
@@ -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",