lager-cli 0.66.0__tar.gz → 0.67.0__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 (170) hide show
  1. {lager_cli-0.66.0/lager_cli.egg-info → lager_cli-0.67.0}/PKG-INFO +1 -1
  2. {lager_cli-0.66.0 → lager_cli-0.67.0}/__init__.py +1 -1
  3. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/net_tui.py +174 -54
  4. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/nets.py +30 -6
  5. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/_local_install.py +4 -2
  6. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/_remote_macos.py +6 -3
  7. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/install.py +3 -2
  8. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/macos_box.py +185 -33
  9. {lager_cli-0.66.0 → lager_cli-0.67.0/lager_cli.egg-info}/PKG-INFO +1 -1
  10. {lager_cli-0.66.0 → lager_cli-0.67.0}/LICENSE +0 -0
  11. {lager_cli-0.66.0 → lager_cli-0.67.0}/MANIFEST.in +0 -0
  12. {lager_cli-0.66.0 → lager_cli-0.67.0}/NOTICE +0 -0
  13. {lager_cli-0.66.0 → lager_cli-0.67.0}/README.md +0 -0
  14. {lager_cli-0.66.0 → lager_cli-0.67.0}/__main__.py +0 -0
  15. {lager_cli-0.66.0 → lager_cli-0.67.0}/address_utils.py +0 -0
  16. {lager_cli-0.66.0 → lager_cli-0.67.0}/battery/__init__.py +0 -0
  17. {lager_cli-0.66.0 → lager_cli-0.67.0}/battery/battery_tui.py +0 -0
  18. {lager_cli-0.66.0 → lager_cli-0.67.0}/battery/websocket_client.py +0 -0
  19. {lager_cli-0.66.0 → lager_cli-0.67.0}/box_storage.py +0 -0
  20. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/__init__.py +0 -0
  21. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/__init__.py +0 -0
  22. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_device_identity.py +0 -0
  23. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_gateway.py +0 -0
  24. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_host_ops.py +0 -0
  25. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_macos_target.py +0 -0
  26. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_mount_prep.py +0 -0
  27. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_net_preflight.py +0 -0
  28. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_pip_validation.py +0 -0
  29. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_shim_verbs.py +0 -0
  30. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_ssh.py +0 -0
  31. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/_start_script.py +0 -0
  32. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/bench.py +0 -0
  33. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/box_group.py +0 -0
  34. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/boxes.py +0 -0
  35. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/config.py +0 -0
  36. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/diagnose.py +0 -0
  37. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/drivers.py +0 -0
  38. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/dut.py +0 -0
  39. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/hello.py +0 -0
  40. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/instruments.py +0 -0
  41. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/labjack_pins.py +0 -0
  42. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/lock.py +0 -0
  43. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/ssh.py +0 -0
  44. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/box/ssh_setup.py +0 -0
  45. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/__init__.py +0 -0
  46. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/ble.py +0 -0
  47. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/ble_sniffer.py +0 -0
  48. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/blufi.py +0 -0
  49. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/i2c.py +0 -0
  50. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/router.py +0 -0
  51. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/spi.py +0 -0
  52. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/uart.py +0 -0
  53. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/usb.py +0 -0
  54. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/websocket_client.py +0 -0
  55. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/communication/wifi.py +0 -0
  56. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/custom.py +0 -0
  57. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/__init__.py +0 -0
  58. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/arm.py +0 -0
  59. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/__init__.py +0 -0
  60. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/commands.py +0 -0
  61. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/net_cache.py +0 -0
  62. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/rtt_websocket_client.py +0 -0
  63. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/service_client.py +0 -0
  64. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/service_helper.py +0 -0
  65. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/debug/tunnel.py +0 -0
  66. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/devenv.py +0 -0
  67. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/development/python.py +0 -0
  68. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/__init__.py +0 -0
  69. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/adc.py +0 -0
  70. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/dac.py +0 -0
  71. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/dmm.py +0 -0
  72. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/energy.py +0 -0
  73. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/gpi.py +0 -0
  74. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/gpo.py +0 -0
  75. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/logic.py +0 -0
  76. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/scope.py +0 -0
  77. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/thermocouple.py +0 -0
  78. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/measurement/watt.py +0 -0
  79. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/__init__.py +0 -0
  80. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/battery.py +0 -0
  81. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/battery_model_csv.py +0 -0
  82. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/eload.py +0 -0
  83. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/solar.py +0 -0
  84. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/power/supply.py +0 -0
  85. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/security/__init__.py +0 -0
  86. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/security/hsm.py +0 -0
  87. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/__init__.py +0 -0
  88. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/_host_cli.py +0 -0
  89. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/binaries.py +0 -0
  90. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/defaults.py +0 -0
  91. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/exec_.py +0 -0
  92. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/install_wheel.py +0 -0
  93. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/lease.py +0 -0
  94. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/login.py +0 -0
  95. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/logs.py +0 -0
  96. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/uninstall.py +0 -0
  97. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/update.py +0 -0
  98. {lager_cli-0.66.0 → lager_cli-0.67.0}/commands/utility/webcam.py +0 -0
  99. {lager_cli-0.66.0 → lager_cli-0.67.0}/config.py +0 -0
  100. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/__init__.py +0 -0
  101. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/ci_detection.py +0 -0
  102. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/constants.py +0 -0
  103. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/core.py +0 -0
  104. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/error_handlers.py +0 -0
  105. {lager_cli-0.66.0 → lager_cli-0.67.0}/context/session.py +0 -0
  106. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/__init__.py +0 -0
  107. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/custom_drivers.py +0 -0
  108. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/group_usage.py +0 -0
  109. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/matchers.py +0 -0
  110. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/net_group.py +0 -0
  111. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/net_helpers.py +0 -0
  112. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/net_storage.py +0 -0
  113. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/param_types.py +0 -0
  114. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/ssh_utils.py +0 -0
  115. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/tui_keys.py +0 -0
  116. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/tui_ws_bridge.py +0 -0
  117. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/utils.py +0 -0
  118. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/version_skew.py +0 -0
  119. {lager_cli-0.66.0 → lager_cli-0.67.0}/core/ws_diagnose.py +0 -0
  120. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/__init__.py +0 -0
  121. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/macos_remote.py +0 -0
  122. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/__init__.py +0 -0
  123. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/configure_docker_dns.py +0 -0
  124. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/configure_docker_dns.sh +0 -0
  125. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/convert_to_sparse_checkout.sh +0 -0
  126. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/setup_and_deploy_box.sh +0 -0
  127. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/scripts/setup_ssh_key.sh +0 -0
  128. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/security/__init__.py +0 -0
  129. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/security/etc_lager_perms.sh +0 -0
  130. {lager_cli-0.66.0 → lager_cli-0.67.0}/deployment/security/secure_box_firewall.sh +0 -0
  131. {lager_cli-0.66.0 → lager_cli-0.67.0}/errors.py +0 -0
  132. {lager_cli-0.66.0 → lager_cli-0.67.0}/exceptions.py +0 -0
  133. {lager_cli-0.66.0 → lager_cli-0.67.0}/gateway_auth.py +0 -0
  134. {lager_cli-0.66.0 → lager_cli-0.67.0}/gateway_tunnel.py +0 -0
  135. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/__init__.py +0 -0
  136. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/box_config.py +0 -0
  137. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/measurement/__init__.py +0 -0
  138. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/measurement/scope.py +0 -0
  139. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/measurement/scope_stream.py +0 -0
  140. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/power/__init__.py +0 -0
  141. {lager_cli-0.66.0 → lager_cli-0.67.0}/impl/power/enable_disable.py +0 -0
  142. {lager_cli-0.66.0 → lager_cli-0.67.0}/lager_cli.egg-info/SOURCES.txt +0 -0
  143. {lager_cli-0.66.0 → lager_cli-0.67.0}/lager_cli.egg-info/dependency_links.txt +0 -0
  144. {lager_cli-0.66.0 → lager_cli-0.67.0}/lager_cli.egg-info/entry_points.txt +0 -0
  145. {lager_cli-0.66.0 → lager_cli-0.67.0}/lager_cli.egg-info/requires.txt +0 -0
  146. {lager_cli-0.66.0 → lager_cli-0.67.0}/lager_cli.egg-info/top_level.txt +0 -0
  147. {lager_cli-0.66.0 → lager_cli-0.67.0}/lease_client.py +0 -0
  148. {lager_cli-0.66.0 → lager_cli-0.67.0}/main.py +0 -0
  149. {lager_cli-0.66.0 → lager_cli-0.67.0}/pyproject.toml +0 -0
  150. {lager_cli-0.66.0 → lager_cli-0.67.0}/run_record.py +0 -0
  151. {lager_cli-0.66.0 → lager_cli-0.67.0}/safe_unpickle.py +0 -0
  152. {lager_cli-0.66.0 → lager_cli-0.67.0}/setup.cfg +0 -0
  153. {lager_cli-0.66.0 → lager_cli-0.67.0}/setup.py +0 -0
  154. {lager_cli-0.66.0 → lager_cli-0.67.0}/simple_hdlc.py +0 -0
  155. {lager_cli-0.66.0 → lager_cli-0.67.0}/sort_utils.py +0 -0
  156. {lager_cli-0.66.0 → lager_cli-0.67.0}/status.py +0 -0
  157. {lager_cli-0.66.0 → lager_cli-0.67.0}/supply/__init__.py +0 -0
  158. {lager_cli-0.66.0 → lager_cli-0.67.0}/supply/supply_tui.py +0 -0
  159. {lager_cli-0.66.0 → lager_cli-0.67.0}/supply/websocket_client.py +0 -0
  160. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/__init__.py +0 -0
  161. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/core/__init__.py +0 -0
  162. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/core/executor.py +0 -0
  163. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/main.py +0 -0
  164. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/__init__.py +0 -0
  165. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/completer.py +0 -0
  166. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/display.py +0 -0
  167. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/logo.py +0 -0
  168. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/repl.py +0 -0
  169. {lager_cli-0.66.0 → lager_cli-0.67.0}/terminal/ui/themes.py +0 -0
  170. {lager_cli-0.66.0 → lager_cli-0.67.0}/update_check.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lager-cli
3
- Version: 0.66.0
3
+ Version: 0.67.0
4
4
  Summary: Lager CLI - Box and Docker connectivity
5
5
  Home-page: https://github.com/lagerdata/lager
6
6
  Author: Lager Data
@@ -7,4 +7,4 @@ Lager CLI
7
7
  A Command Line Interface for Lager Data
8
8
  """
9
9
 
10
- __version__ = '0.66.0'
10
+ __version__ = '0.67.0'
@@ -426,7 +426,11 @@ def _validate_nets_before_save(nets: list["Net"]) -> list[tuple["Net", str]]:
426
426
 
427
427
 
428
428
  def _save_nets_batch(dut: str, nets: list["Net"], custom_names: dict[str, str] | None = None) -> bool:
429
- """Save multiple nets, one PUT /nets/<name> per record."""
429
+ """Save multiple nets, one PUT /nets/<name> per record.
430
+
431
+ A net's FTDI channel is saved as ``params.interface``, as ``nets add
432
+ --interface`` saves it.
433
+ """
430
434
  if not nets:
431
435
  return True
432
436
 
@@ -451,8 +455,11 @@ def _save_nets_batch(dut: str, nets: list["Net"], custom_names: dict[str, str] |
451
455
  "instrument": n.instrument,
452
456
  "pin": n.chan,
453
457
  }
454
- if n.params:
455
- record["params"] = n.params
458
+ params = dict(n.params) if n.params else {}
459
+ if n.interface is not None:
460
+ params["interface"] = n.interface
461
+ if params:
462
+ record["params"] = params
456
463
  nets_data.append(record)
457
464
 
458
465
  # One PUT per record; keep going on individual failures so one bad net
@@ -467,6 +474,13 @@ def _save_nets_batch(dut: str, nets: list["Net"], custom_names: dict[str, str] |
467
474
 
468
475
  return saved_count > 0
469
476
 
477
+ def _record_interface(rec: dict) -> str | None:
478
+ """``params.interface`` of a saved net record, as a string, or None."""
479
+ params = rec.get("params")
480
+ value = params.get("interface") if isinstance(params, dict) else None
481
+ return None if value is None else str(value)
482
+
483
+
470
484
  def is_single_channel_taken(all_nets: list["Net"], inst: str, addr: str, role: str | None = None) -> bool:
471
485
  """
472
486
  True if a *saved* net already exists for this single-channel
@@ -508,10 +522,21 @@ class Net:
508
522
  # True once the user has been through the pin dialog for this net, so
509
523
  # the add flow doesn't prompt again for pins already chosen.
510
524
  pins_confirmed: bool = False
525
+ # FTDI channel letter (``params.interface``) of a saved FT2232H/FT4232H
526
+ # gpio/i2c/spi net, saved or not. Kept apart from ``params`` so the
527
+ # LabJack pin dialog resetting ``params`` can never drop it. The Add list
528
+ # has one unsaved row per channel and pin (see _ftdi_row_channels).
529
+ interface: str | None = None
511
530
  _uid: str = field(init=False)
512
531
 
513
532
  def __post_init__(self) -> None:
514
- self._uid = _uid(self.instrument, self.chan, self.type, self.net)
533
+ self.rekey()
534
+
535
+ def rekey(self) -> None:
536
+ """Recompute the row key after a rename. The FTDI channel is part of
537
+ it, so pin 1 on channels C and D are two rows."""
538
+ chan = f"{self.interface}:{self.chan}" if self.interface else self.chan
539
+ self._uid = _uid(self.instrument, chan, self.type, self.net)
515
540
 
516
541
  # ───── table rows
517
542
  def as_row_main(self) -> list[str]:
@@ -520,7 +545,7 @@ class Net:
520
545
  f"{status} {self.net}",
521
546
  self.type.upper(),
522
547
  self.instrument.replace("_", " "),
523
- self.chan,
548
+ _display_chan(self),
524
549
  self.addr,
525
550
  "[Rename]",
526
551
  "[Delete]",
@@ -533,7 +558,7 @@ class Net:
533
558
  display_name,
534
559
  self.type.upper(),
535
560
  self.instrument.replace("_", " "),
536
- self.chan,
561
+ _display_chan(self),
537
562
  self.addr,
538
563
  "[Rename]",
539
564
  ]
@@ -551,6 +576,86 @@ def _is_pin_configurable(net: "Net") -> bool:
551
576
  return net.instrument in _PIN_CONFIGURABLE_INSTRUMENTS and net.type in ("i2c", "spi")
552
577
 
553
578
 
579
+ # ──────────── FTDI channel (params.interface) ────────────
580
+ # The channel tables and validation live in nets.py, beside ``nets add
581
+ # --interface``, so the CLI and the TUI accept and refuse the same values
582
+ # (test_nets_add_ftdi_interface.py keeps nets.py in lockstep with the box's
583
+ # ftdi_url.py). nets.py imports this module at load time, so the import here
584
+ # is deferred to call time.
585
+
586
+ def _ftdi_rules():
587
+ # By module path: ``from . import nets`` would return the package's
588
+ # ``nets`` click group, which shadows the module name.
589
+ import importlib
590
+ return importlib.import_module(f"{__package__}.nets")
591
+
592
+
593
+ def _ftdi_part(net: "Net") -> str | None:
594
+ """Canonical FTDI part name when *net* is an FTDI gpio/i2c/spi net."""
595
+ rules = _ftdi_rules()
596
+ part = rules.canonical_instrument(net.instrument)
597
+ if part in rules._FTDI_CHANNELS and net.type in rules._FTDI_INTERFACE_ROLES:
598
+ return part
599
+ return None
600
+
601
+
602
+ def _ftdi_channel_choices(net: "Net") -> str | None:
603
+ """Channel letters this net may use, or None when there is no choice.
604
+
605
+ gpio may use every channel of the part; i2c and spi need an MPSSE engine
606
+ (A and B). The single-channel FT232H, non-FTDI parts and other roles get
607
+ None: no channel prompt and no ``params.interface``.
608
+ """
609
+ part = _ftdi_part(net)
610
+ if part is None:
611
+ return None
612
+ rules = _ftdi_rules()
613
+ if len(rules._FTDI_CHANNELS[part]) < 2:
614
+ return None
615
+ if net.type == "gpio":
616
+ return rules._FTDI_CHANNELS[part]
617
+ return rules._FTDI_MPSSE_CHANNELS[part]
618
+
619
+
620
+ def _ftdi_iface(net: "Net") -> str | None:
621
+ """The FTDI channel component of a net's identity.
622
+
623
+ A net with no interface is on channel A, as on the box. Every other net
624
+ returns None.
625
+ """
626
+ if _ftdi_part(net) is None:
627
+ return None
628
+ return _ftdi_rules()._normalize_ftdi_interface(net.interface)
629
+
630
+
631
+ def _net_identity(net: "Net") -> tuple:
632
+ """Key for "the same physical channel": (type, instrument, pin, address,
633
+ FTDI channel). Two pin-1 nets on channels C and D differ."""
634
+ return (net.type, net.instrument, net.chan, net.addr, _ftdi_iface(net))
635
+
636
+
637
+ def _ftdi_row_channels(instrument: str, role: str) -> list[str | None]:
638
+ """The FTDI channels to offer a scanned pin on, one Add row each.
639
+
640
+ The scanner reports pins without a channel. On an FT2232H or FT4232H the
641
+ Add list shows the pin once per channel its role may use (``A:0`` to
642
+ ``D:7`` for gpio, ``A``/``B`` for i2c and spi), so every free channel and
643
+ pin is visible before anything is picked. Other parts get ``[None]``.
644
+ """
645
+ probe = Net(instrument, "", role, "", "", saved=False)
646
+ choices = _ftdi_channel_choices(probe)
647
+ return list(choices) if choices else [None]
648
+
649
+
650
+ def _display_chan(net: "Net") -> str:
651
+ """The channel column: ``C:1`` for a multi-channel FTDI net (a saved one
652
+ with no interface shows ``A``), the pin otherwise."""
653
+ if _ftdi_channel_choices(net):
654
+ letter = _ftdi_rules()._normalize_ftdi_interface(net.interface)
655
+ return f"{letter}:{net.chan}"
656
+ return str(net.chan)
657
+
658
+
554
659
  @dataclass
555
660
  class TreeNodeData:
556
661
  """Data attached to each tree node."""
@@ -580,7 +685,7 @@ class SavedNetsTree(Tree[TreeNodeData]):
580
685
  edit_btn = "[reverse][⋯][/reverse]" if highlight_button == "edit" else "[⋯]"
581
686
  delete_btn = "[reverse][✕][/reverse]" if highlight_button == "delete" else "[✕]"
582
687
  script_tag = " [dim](script)[/dim]" if net.has_script else ""
583
- return f"[bold]{net.net}[/bold] | {net.type.upper()} | Ch: {net.chan}{script_tag} {rename_btn} {edit_btn} {delete_btn}"
688
+ return f"[bold]{net.net}[/bold] | {net.type.upper()} | Ch: {_display_chan(net)}{script_tag} {rename_btn} {edit_btn} {delete_btn}"
584
689
 
585
690
  def _get_highlighted_button(self, net_key: str) -> str | None:
586
691
  """Get which button should be highlighted for a given net (hover takes precedence)."""
@@ -618,7 +723,7 @@ class SavedNetsTree(Tree[TreeNodeData]):
618
723
 
619
724
  def _get_button_at_position(self, net: Net, x: int) -> str | None:
620
725
  """Determine which button (if any) is at the given x position."""
621
- content = f"{net.net} | {net.type.upper()} | Ch: {net.chan}"
726
+ content = f"{net.net} | {net.type.upper()} | Ch: {_display_chan(net)}"
622
727
  if net.has_script:
623
728
  content += " (script)"
624
729
  content += " "
@@ -887,7 +992,7 @@ class AddNetsTree(Tree[TreeNodeData]):
887
992
  status = "[SELECTED]" if selected else "[ADD]"
888
993
  edit_btn = "[reverse][✎][/reverse]" if highlight_button == "edit" else "[✎]"
889
994
  return (f"{status} [bold]{custom_name}[/bold] | {net.type.upper()} | "
890
- f"Ch: {net.chan} {edit_btn}")
995
+ f"Ch: {_display_chan(net)} {edit_btn}")
891
996
 
892
997
  def _get_highlighted_button(self, net_key: str) -> str | None:
893
998
  """Get which button should be highlighted for a given net (hover takes precedence)."""
@@ -926,7 +1031,7 @@ class AddNetsTree(Tree[TreeNodeData]):
926
1031
  custom_name = self.custom_names.get(net_key, net.net)
927
1032
  selected = net_key in self.chosen
928
1033
  status = "[SELECTED]" if selected else "[ADD]"
929
- content = f"{status} {custom_name} | {net.type.upper()} | Ch: {net.chan} "
1034
+ content = f"{status} {custom_name} | {net.type.upper()} | Ch: {_display_chan(net)} "
930
1035
  # Button: [✎] is 3 chars
931
1036
 
932
1037
  content_end = len(content)
@@ -1197,7 +1302,7 @@ class NetActionDialog(Screen):
1197
1302
  f"Name: {self.net.net}\n"
1198
1303
  f"Type: {self.net.type.upper()}\n"
1199
1304
  f"Instrument: {self.net.instrument.replace('_', ' ')}\n"
1200
- f"Channel: {self.net.chan}\n"
1305
+ f"Channel: {_display_chan(self.net)}\n"
1201
1306
  f"Address: {self.net.addr}",
1202
1307
  classes="dialog-content"
1203
1308
  )
@@ -1374,20 +1479,24 @@ class ConfirmDelete(Screen):
1374
1479
  if self.net in app.nets:
1375
1480
  app.nets.remove(self.net)
1376
1481
  auto_name = f"{self.net.type}{self.net.chan}"
1482
+ # The Add row for this channel, back in the list. A multi-channel
1483
+ # FTDI net keeps its channel: deleting C:1 gives back the C:1 row.
1484
+ placeholder = Net(
1485
+ instrument=self.net.instrument,
1486
+ chan=self.net.chan,
1487
+ type=self.net.type,
1488
+ net=auto_name,
1489
+ addr=self.net.addr,
1490
+ saved=False,
1491
+ interface=_ftdi_iface(self.net) if _ftdi_channel_choices(self.net) else None,
1492
+ )
1377
1493
  duplicate = next(
1378
- (n for n in app.nets if (n.type, n.instrument, n.chan, n.addr) ==
1379
- (self.net.type, self.net.instrument, self.net.chan, self.net.addr)),
1494
+ (n for n in app.nets
1495
+ if _net_identity(n) == _net_identity(placeholder)),
1380
1496
  None,
1381
1497
  )
1382
1498
  if duplicate is None:
1383
- app.nets.append(Net(
1384
- instrument=self.net.instrument,
1385
- chan=self.net.chan,
1386
- type=self.net.type,
1387
- net=auto_name,
1388
- addr=self.net.addr,
1389
- saved=False,
1390
- ))
1499
+ app.nets.append(placeholder)
1391
1500
  if out.get("saved") is not None:
1392
1501
  app._apply_saved_records(out["saved"])
1393
1502
  app._refresh_table()
@@ -1469,12 +1578,11 @@ class RenameDialog(Screen):
1469
1578
 
1470
1579
  # Update the net name locally
1471
1580
  self.net.net = new_name
1472
- self.net._uid = _uid(self.net.instrument, self.net.chan, self.net.type, new_name)
1581
+ self.net.rekey()
1473
1582
 
1474
1583
  placeholder = next(
1475
1584
  (n for n in app.nets if not n.saved and
1476
- (n.type, n.instrument, n.chan, n.addr) ==
1477
- (self.net.type, self.net.instrument, self.net.chan, self.net.addr)),
1585
+ _net_identity(n) == _net_identity(self.net)),
1478
1586
  None,
1479
1587
  )
1480
1588
  if placeholder is not None:
@@ -1826,9 +1934,9 @@ class AddScreen(Screen):
1826
1934
  if n.saved:
1827
1935
  return False
1828
1936
 
1829
- # Hide unsaved nets if a saved net already exists for the same physical channel
1830
- # Key: (type, instrument, channel, address)
1831
- if any(s.saved and s.type == n.type and s.instrument == n.instrument and s.chan == n.chan and s.addr == n.addr for s in self.nets):
1937
+ # Hide unsaved nets if a saved net already exists for the same physical
1938
+ # channel (see _net_identity, which includes the FTDI channel).
1939
+ if any(s.saved and _net_identity(s) == _net_identity(n) for s in self.nets):
1832
1940
  return False
1833
1941
 
1834
1942
  # Single-channel dual-role chips (_SINGLE_CHANNEL_INST) are NOT
@@ -1877,10 +1985,10 @@ class AddScreen(Screen):
1877
1985
  # Deduplicate nets by (instrument, channel, address) - NOT by name
1878
1986
  # This ensures saved "hahahah" on channel 2 deduplicates with unsaved "usb2" on channel 2
1879
1987
  # Prioritize unsaved nets over saved ones when deduplicating
1880
- uniq: dict[tuple[str, str, str, str], Net] = {}
1988
+ uniq: dict[tuple, Net] = {}
1881
1989
  for n in self.nets:
1882
- # Key by (type, instrument, channel, address) - excludes name
1883
- dedup_key = (n.type, n.instrument, n.chan, n.addr)
1990
+ # Key by physical channel (_net_identity) - excludes name
1991
+ dedup_key = _net_identity(n)
1884
1992
  # Only add if key doesn't exist, OR if this net is unsaved and existing is saved
1885
1993
  if dedup_key not in uniq or (not n.saved and uniq[dedup_key].saved):
1886
1994
  uniq[dedup_key] = n
@@ -3284,6 +3392,7 @@ class NetApp(App):
3284
3392
  purpose=rec.get("purpose", ""),
3285
3393
  notes=rec.get("notes", ""),
3286
3394
  tags=rec.get("tags", []),
3395
+ interface=_record_interface(rec),
3287
3396
  ) for rec in saved_from_disk
3288
3397
  ]
3289
3398
  self._ensure_autogen_unsaved()
@@ -3327,7 +3436,7 @@ class NetApp(App):
3327
3436
 
3328
3437
  def _ensure_autogen_unsaved(self) -> None:
3329
3438
  # Track which channels have unsaved placeholders
3330
- unsaved_keys = {(n.type, n.instrument, n.chan, n.addr) for n in self.nets if not n.saved}
3439
+ unsaved_keys = {_net_identity(n) for n in self.nets if not n.saved}
3331
3440
  role_counter: dict[str, int] = defaultdict(int)
3332
3441
  idx_re = re.compile(r"^([A-Za-z]+)(\d+)$")
3333
3442
 
@@ -3347,15 +3456,20 @@ class NetApp(App):
3347
3456
  channels = uart_channel_paths(dev, channels)
3348
3457
  # Sort channels to ensure consistent ordering
3349
3458
  sorted_channels = sorted(channels, key=lambda ch: str(ch))
3350
- for ch in sorted_channels:
3351
- key = (role, instr, ch, addr)
3352
- # Only skip if an UNSAVED placeholder already exists
3353
- if key in unsaved_keys:
3354
- continue
3355
- role_counter[role] += 1
3356
- auto_name = f"{_first_word(role)}{role_counter[role]}"
3357
- self.nets.append(Net(instr, ch, role, auto_name, addr, saved=False))
3358
- unsaved_keys.add(key)
3459
+ # One row per FTDI channel on an FT2232H/FT4232H.
3460
+ for iface in _ftdi_row_channels(instr, role):
3461
+ for ch in sorted_channels:
3462
+ candidate = Net(instr, ch, role, "", addr, saved=False,
3463
+ interface=iface)
3464
+ key = _net_identity(candidate)
3465
+ # Only skip if an UNSAVED placeholder already exists
3466
+ if key in unsaved_keys:
3467
+ continue
3468
+ role_counter[role] += 1
3469
+ candidate.net = f"{_first_word(role)}{role_counter[role]}"
3470
+ candidate.rekey()
3471
+ self.nets.append(candidate)
3472
+ unsaved_keys.add(key)
3359
3473
 
3360
3474
  def on_tree_node_selected(self, event: Tree.NodeSelected) -> None:
3361
3475
  """Handle tree node selection for saved nets - show action dialog."""
@@ -3537,6 +3651,7 @@ def launch_tui(ctx: click.Context, dut: str) -> None:
3537
3651
  purpose=rec.get("purpose", ""),
3538
3652
  notes=rec.get("notes", ""),
3539
3653
  tags=rec.get("tags", []),
3654
+ interface=_record_interface(rec),
3540
3655
  ))
3541
3656
 
3542
3657
  # Now generate auto-names for new devices, continuing from highest saved number
@@ -3549,22 +3664,27 @@ def launch_tui(ctx: click.Context, dut: str) -> None:
3549
3664
  channels = uart_channel_paths(dev, channels)
3550
3665
  # Sort channels to ensure consistent ordering (e.g., /dev/ttyUSB0 before /dev/ttyUSB1)
3551
3666
  sorted_channels = sorted(channels, key=lambda ch: str(ch))
3552
- for ch in sorted_channels:
3553
- # Check if this exact net already exists - skip counter increment if so
3554
- already_exists = any(
3555
- n.type == role
3556
- and n.instrument == instr
3557
- and str(n.chan) == str(ch)
3558
- and n.addr == addr
3559
- and n.saved
3560
- for n in nets
3561
- )
3667
+ # One row per FTDI channel on an FT2232H/FT4232H, channel by channel.
3668
+ for iface in _ftdi_row_channels(instr, role):
3669
+ for ch in sorted_channels:
3670
+ row = Net(instr, ch, role, "", addr, saved=False, interface=iface)
3671
+ # Check if this exact net already exists - skip counter increment if so
3672
+ already_exists = any(
3673
+ n.type == role
3674
+ and n.instrument == instr
3675
+ and str(n.chan) == str(ch)
3676
+ and n.addr == addr
3677
+ and n.saved
3678
+ and _ftdi_iface(n) == _ftdi_iface(row)
3679
+ for n in nets
3680
+ )
3562
3681
 
3563
- if not already_exists:
3564
- role_counter[role] += 1
3682
+ if not already_exists:
3683
+ role_counter[role] += 1
3565
3684
 
3566
- auto_name = f"{_first_word(role)}{role_counter[role]}"
3567
- nets.append(Net(instr, ch, role, auto_name, addr, saved=False))
3685
+ row.net = f"{_first_word(role)}{role_counter[role]}"
3686
+ row.rekey()
3687
+ nets.append(row)
3568
3688
 
3569
3689
  # Launch the Textual TUI
3570
3690
  NetApp(ctx, dut, inst_list, nets).run()
@@ -1489,19 +1489,42 @@ def set_capture_cmd(ctx: click.Context, name: str, port_path: str | None,
1489
1489
  fg="green")
1490
1490
 
1491
1491
 
1492
- # LabJacks that keep a power-up I/O configuration in flash. Mirrors the box's
1493
- # own check (nets_handler._POWER_UP_INSTRUMENT_RE); the box decides.
1494
- _POWER_UP_INSTRUMENT_RE = re.compile(r"labjack[_\-\s]*(t7|u3)", re.IGNORECASE)
1492
+ # Instrument families whose gpio nets can declare a power-up level:
1493
+ # (backend name the box reports, device label, instruments it matches).
1494
+ # Mirrors the box's table (box/lager/io/gpio/power_up/__init__.py FAMILIES) so
1495
+ # a bad request fails before anything is written; the box still decides, and
1496
+ # a box older than a family here refuses that family itself.
1497
+ _POWER_UP_FAMILIES = (
1498
+ ("labjack", "LabJack", re.compile(r"labjack[_\-\s]*(t7|u3)", re.IGNORECASE)),
1499
+ )
1500
+ _POWER_UP_SUPPORTED = "LabJack T7 and U3"
1495
1501
  _POWER_UP_LEVELS = ("low", "high", "none")
1496
1502
 
1497
1503
 
1504
+ def _power_up_family(instrument) -> Optional[str]:
1505
+ """The power-up backend name for ``instrument``, or None."""
1506
+ text = str(instrument or "")
1507
+ for name, _label, pattern in _POWER_UP_FAMILIES:
1508
+ if pattern.search(text):
1509
+ return name
1510
+ return None
1511
+
1512
+
1513
+ def _power_up_label(backend) -> str:
1514
+ """What the report calls a device of ``backend`` ("LabJack")."""
1515
+ for name, label, _pattern in _POWER_UP_FAMILIES:
1516
+ if name == backend:
1517
+ return label
1518
+ return "Device"
1519
+
1520
+
1498
1521
  def _power_up_problem(record: dict) -> Optional[str]:
1499
1522
  """Why ``record`` cannot declare a power-up level, or None."""
1500
1523
  if record.get("role") != "gpio":
1501
1524
  return f"'{record.get('name')}' is a {record.get('role')} net; power-up levels are for gpio nets"
1502
- if not _POWER_UP_INSTRUMENT_RE.search(str(record.get("instrument") or "")):
1525
+ if _power_up_family(record.get("instrument")) is None:
1503
1526
  return (f"'{record.get('name')}' is on a {record.get('instrument') or 'unknown instrument'}, "
1504
- "which has no stored power-up configuration; only LabJack T7 and U3 nets have one")
1527
+ f"which lager cannot set a power-up level on; only {_POWER_UP_SUPPORTED} nets can have one")
1505
1528
  return None
1506
1529
 
1507
1530
 
@@ -1560,7 +1583,8 @@ def _render_power_up_report(report: dict) -> None:
1560
1583
  model = dev.get("model")
1561
1584
  serial = dev.get("serial")
1562
1585
  # An error entry carries only its device_id, so name the device by that.
1563
- title = "LabJack" + (f" {model}" if model else "")
1586
+ # A box predating backend names reported LabJacks only.
1587
+ title = _power_up_label(dev.get("backend") or "labjack") + (f" {model}" if model else "")
1564
1588
  if serial:
1565
1589
  title += f" (serial {serial})"
1566
1590
  elif dev.get("device_id"):
@@ -106,7 +106,9 @@ def install_locally(ctx, *, version, version_defaulted, yes, fork=None, platform
106
106
  from ... import __version__ as cli_version
107
107
  from ...deployment import macos_box
108
108
 
109
- checkout = macos_box.running_from_checkout()
109
+ # A version named on the command line wins over the checkout this CLI
110
+ # runs from: that is how a branch is installed with a development CLI.
111
+ checkout = macos_box.running_from_checkout() if version_defaulted else None
110
112
  if checkout is not None:
111
113
  click.echo(f"Installing a Lager Box on this Mac from the checkout at {checkout}.")
112
114
  else:
@@ -156,7 +158,7 @@ def install_locally(ctx, *, version, version_defaulted, yes, fork=None, platform
156
158
  version, cli_version, echo=click.echo,
157
159
  confirm=(lambda question: True) if yes
158
160
  else (lambda question: click.confirm(question, default=True)),
159
- skip=skip)
161
+ skip=skip, use_checkout=version_defaulted)
160
162
 
161
163
  add_box(name, macos_box.LOCAL_ADDRESS, user=getpass.getuser(),
162
164
  version=result.box_version, python_port=macos_box.PYTHON_SERVICE_PORT)
@@ -216,7 +216,8 @@ def mac_sudo_needs_a_terminal(ssh_host, identity_args, isatty=None, run=None) ->
216
216
 
217
217
 
218
218
  def install_remote_macos(ctx, *, ssh_host, ip, user, box, identity_args, version, yes,
219
- fork=None, skip_jlink=False, skip_picoscope=False, update=False):
219
+ fork=None, skip_jlink=False, skip_picoscope=False, update=False,
220
+ version_defaulted=True):
220
221
  if fork:
221
222
  raise click.UsageError("--fork is not supported for a Box on a Mac yet.")
222
223
  from ... import __version__ as cli_version
@@ -233,7 +234,9 @@ def install_remote_macos(ctx, *, ssh_host, ip, user, box, identity_args, version
233
234
  fixes=["Run the same command in a terminal window, or create the "
234
235
  "directory on that Mac first:"] + macos_box.config_dir_fixes(user)[:-1])
235
236
 
236
- checkout = macos_box.running_from_checkout()
237
+ # A version named on the command line wins over the checkout this CLI
238
+ # runs from: the Mac then downloads that version itself.
239
+ checkout = macos_box.running_from_checkout() if version_defaulted else None
237
240
  click.echo()
238
241
  click.secho(f"{ip} is a Mac.", fg='cyan', bold=True)
239
242
  if checkout is not None:
@@ -354,4 +357,4 @@ def update_remote_macos(ctx, *, ip, user, version, yes, check=False, fork=None):
354
357
  install_remote_macos(ctx, ssh_host=ssh_host, ip=ip, user=user,
355
358
  box=get_box_name_by_ip(ip), identity_args=identity_args,
356
359
  version=version or default_box_version(), yes=yes, fork=fork,
357
- update=True)
360
+ update=True, version_defaulted=not version)
@@ -358,7 +358,7 @@ def _record_install_state(runner, ssh_host, *, version, cli_version, fork=None):
358
358
  @click.option("--box", default=None, help="Box name (uses stored IP and username)")
359
359
  @click.option("--ip", default=None, help="Target box IP address or DNS hostname")
360
360
  @click.option("--user", default=None, help="SSH username (default: lagerdata, or stored username if using --box)")
361
- @click.option("--version", "version", default=None, help="Version to deploy: a release tag (e.g. v0.21.3), a branch (main, staging), or a full 40-character commit SHA (default: this CLI's release tag)")
361
+ @click.option("--version", "version", default=None, help="Version to deploy: a release tag (e.g. v0.21.3), a branch (main, staging), or a full 40-character commit SHA (default: this CLI's release tag). On a Mac, a branch or commit runs on the published image of the release it is based on")
362
362
  @click.option("--skip-jlink", is_flag=True, help="Skip J-Link installation")
363
363
  @click.option("--skip-picoscope", is_flag=True, help="Skip PicoScope 7 SDK installation")
364
364
  @click.option("--skip-firewall", is_flag=True, help="Skip UFW firewall configuration")
@@ -617,7 +617,8 @@ def install(ctx, box, ip, user, version, skip_jlink, skip_picoscope, skip_firewa
617
617
  install_remote_macos(ctx, ssh_host=ssh_host, ip=ip, user=user, box=box,
618
618
  identity_args=ssh_identity_args(identity),
619
619
  version=version, yes=yes, fork=fork,
620
- skip_jlink=skip_jlink, skip_picoscope=skip_picoscope)
620
+ skip_jlink=skip_jlink, skip_picoscope=skip_picoscope,
621
+ version_defaulted=version_defaulted)
621
622
  return
622
623
 
623
624
  # The deploy's step 2 needs the box's sudo password, and sudo reads it