mpflash 0.7.3__tar.gz → 0.7.4__tar.gz

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 (39) hide show
  1. {mpflash-0.7.3 → mpflash-0.7.4}/PKG-INFO +1 -1
  2. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/list.py +11 -35
  3. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpboard_id/board_id.py +3 -5
  4. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpremoteboard/__init__.py +2 -2
  5. {mpflash-0.7.3 → mpflash-0.7.4}/pyproject.toml +1 -2
  6. {mpflash-0.7.3 → mpflash-0.7.4}/LICENSE +0 -0
  7. {mpflash-0.7.3 → mpflash-0.7.4}/README.md +0 -0
  8. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/__init__.py +0 -0
  9. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/ask_input.py +0 -0
  10. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/cli_download.py +0 -0
  11. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/cli_flash.py +0 -0
  12. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/cli_group.py +0 -0
  13. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/cli_list.py +0 -0
  14. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/cli_main.py +0 -0
  15. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/common.py +0 -0
  16. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/config.py +0 -0
  17. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/download.py +0 -0
  18. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/downloaded.py +0 -0
  19. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/errors.py +0 -0
  20. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash.py +0 -0
  21. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_esp.py +0 -0
  22. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_stm32.py +0 -0
  23. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_stm32_cube.py +0 -0
  24. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_stm32_dfu.py +0 -0
  25. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_uf2.py +0 -0
  26. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_uf2_boardid.py +0 -0
  27. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_uf2_linux.py +0 -0
  28. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/flash_uf2_windows.py +0 -0
  29. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/logger.py +0 -0
  30. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpboard_id/__init__.py +0 -0
  31. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpboard_id/board_info.csv +0 -0
  32. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpboard_id/board_info.json +0 -0
  33. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpremoteboard/mpy_fw_info.py +0 -0
  34. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/mpremoteboard/runner.py +0 -0
  35. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/vendor/dfu.py +0 -0
  36. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/vendor/pydfu.py +0 -0
  37. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/vendor/readme.md +0 -0
  38. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/vendor/versions.py +0 -0
  39. {mpflash-0.7.3 → mpflash-0.7.4}/mpflash/worklist.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mpflash
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Flash and download tool for MicroPython firmwares
5
5
  Home-page: https://github.com/Josverl/micropython-stubber/blob/main/src/mpflash/README.md
6
6
  License: MIT
@@ -51,44 +51,23 @@ def show_mcus(
51
51
  conn_mcus: List[MPRemoteBoard],
52
52
  title: str = "Connected boards",
53
53
  refresh: bool = True,
54
- ):
55
- console.print(mcu_table(conn_mcus, title, refresh))
56
-
57
-
58
- def abbrv_family(family: str, is_narrow: bool) -> str:
59
- ABRV = {"micropython": "upy", "circuitpython": "cpy"}
60
- if is_narrow:
61
- if family in ABRV:
62
- return ABRV[family]
63
- return family[:4]
64
- return family
65
-
66
-
67
- def mcu_table(
68
- conn_mcus: List[MPRemoteBoard],
69
- title: str = "Connected boards",
70
- refresh: bool = True,
71
- ):
54
+ ): # sourcery skip: extract-duplicate-method
72
55
  """Show the list of connected boards in a nice table"""
73
56
  table = Table(
74
57
  title=title,
75
58
  title_style="magenta",
76
59
  header_style="bold magenta",
77
60
  collapse_padding=True,
78
- padding=(0, 0),
79
- # width=80,
61
+ width=110,
80
62
  )
81
- needs_build = any(mcu.build for mcu in conn_mcus)
82
- is_narrow = console.width < 100
83
- table.add_column("Ser." if is_narrow else "Serial", overflow="fold")
84
- table.add_column("Fam." if is_narrow else "Family", overflow="crop", max_width=4 if is_narrow else None)
63
+ table.add_column("Serial", overflow="fold")
64
+ table.add_column("Family")
85
65
  table.add_column("Port")
86
66
  table.add_column("Board", overflow="fold")
87
67
  # table.add_column("Variant") # TODO: add variant
88
68
  table.add_column("CPU")
89
- table.add_column("Version", overflow="fold", max_width=8 if is_narrow else None)
90
- if needs_build:
91
- table.add_column("Bld" if is_narrow else "Build", justify="right")
69
+ table.add_column("Version")
70
+ table.add_column("build", justify="right")
92
71
 
93
72
  for mcu in track(conn_mcus, description="Updating board info", transient=True, update_period=0.1):
94
73
  if refresh:
@@ -97,17 +76,14 @@ def mcu_table(
97
76
  except ConnectionError:
98
77
  continue
99
78
  description = f"[italic bright_cyan]{mcu.description}" if mcu.description else ""
100
- row = [
79
+ table.add_row(
101
80
  mcu.serialport.replace("/dev/", ""),
102
- abbrv_family(mcu.family, is_narrow),
81
+ mcu.family,
103
82
  mcu.port,
104
83
  f"{mcu.board}\n{description}".strip(),
105
84
  # mcu.variant,
106
85
  mcu.cpu,
107
86
  clean_version(mcu.version),
108
- ]
109
- if needs_build:
110
- row.append(mcu.build)
111
-
112
- table.add_row(*row)
113
- return table
87
+ mcu.build,
88
+ )
89
+ console.print(table)
@@ -15,12 +15,12 @@ HERE = Path(__file__).parent
15
15
  ###############################################################################################
16
16
 
17
17
 
18
- def find_board_id_by_description(
18
+ def find_board_id(
19
19
  descr: str, short_descr: str, board_info: Optional[Path] = None, version: str = "stable"
20
20
  ) -> Optional[str]:
21
21
  """Find the MicroPython BOARD_ID based on the description in the firmware"""
22
22
  try:
23
- boards = _find_board_id_by_description(
23
+ boards = find_board_id_by_description(
24
24
  descr=descr,
25
25
  short_descr=short_descr,
26
26
  board_info=board_info,
@@ -32,9 +32,7 @@ def find_board_id_by_description(
32
32
 
33
33
 
34
34
  @functools.lru_cache(maxsize=20)
35
- def _find_board_id_by_description(
36
- *, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None
37
- ):
35
+ def find_board_id_by_description(*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None):
38
36
  """
39
37
  Find the MicroPython BOARD_ID based on the description in the firmware
40
38
  using the pre-built board_info.json file
@@ -13,7 +13,7 @@ from rich.progress import track
13
13
  from tenacity import retry, stop_after_attempt, wait_fixed
14
14
 
15
15
  from mpflash.errors import MPFlashError
16
- from mpflash.mpboard_id.board_id import find_board_id_by_description
16
+ from mpflash.mpboard_id.board_id import find_board_id
17
17
  from mpflash.mpremoteboard.runner import run
18
18
 
19
19
  ###############################################################################################
@@ -116,7 +116,7 @@ class MPRemoteBoard:
116
116
  self.description = descr = info["board"]
117
117
  pos = descr.rfind(" with")
118
118
  short_descr = descr[:pos].strip() if pos != -1 else ""
119
- if board_name := find_board_id_by_description(descr, short_descr):
119
+ if board_name := find_board_id(descr, short_descr):
120
120
  self.board = board_name
121
121
  else:
122
122
  self.board = "UNKNOWN"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mpflash"
3
- version = "0.7.3"
3
+ version = "0.7.4"
4
4
  description = "Flash and download tool for MicroPython firmwares"
5
5
  authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
6
6
  license = "MIT"
@@ -50,7 +50,6 @@ pytest-mock = "^3.10.0"
50
50
  mock = "^4.0.3"
51
51
  distro = "^1.8.0"
52
52
  fasteners = "^0.19"
53
- jsons = "^1.6.3"
54
53
 
55
54
 
56
55
  [build-system]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes