bec-ipython-client 3.79.0__tar.gz → 3.81.1__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 (40) hide show
  1. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/PKG-INFO +1 -1
  2. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/main.py +10 -5
  3. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/pyproject.toml +1 -1
  4. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_bec_client.py +6 -6
  5. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/end-2-end/test_scans_e2e.py +4 -4
  6. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/end-2-end/test_scans_lib_e2e.py +10 -8
  7. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/.gitignore +0 -0
  8. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/__init__.py +0 -0
  9. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/beamline_mixin.py +0 -0
  10. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/bec_magics.py +0 -0
  11. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/bec_startup.py +0 -0
  12. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/__init__.py +0 -0
  13. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/device_progress.py +0 -0
  14. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
  15. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/live_table.py +0 -0
  16. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/move_device.py +0 -0
  17. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/callbacks/utils.py +0 -0
  18. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
  19. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
  20. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
  21. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
  22. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
  23. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
  24. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
  25. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/__init__.py +0 -0
  26. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
  27. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/prettytable.py +0 -0
  28. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/progressbar.py +0 -0
  29. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/bec_ipython_client/signals.py +0 -0
  30. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/demo.py +0 -0
  31. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/conftest.py +0 -0
  32. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_beamline_mixins.py +0 -0
  33. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_device_progress.py +0 -0
  34. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_ipython_live_updates.py +0 -0
  35. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_live_table.py +0 -0
  36. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_move_callback.py +0 -0
  37. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/client_tests/test_pretty_table.py +0 -0
  38. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/conftest.py +0 -0
  39. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/end-2-end/_ensure_requirements_container.py +0 -0
  40. {bec_ipython_client-3.79.0 → bec_ipython_client-3.81.1}/tests/end-2-end/test_procedures_e2e.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_ipython_client
3
- Version: 3.79.0
3
+ Version: 3.81.1
4
4
  Summary: BEC IPython client
5
5
  Project-URL: Bug Tracker, https://github.com/bec-project/bec/issues
6
6
  Project-URL: Homepage, https://github.com/bec-project/bec
@@ -13,6 +13,7 @@ import redis
13
13
  import redis.exceptions
14
14
  from IPython.terminal.ipapp import TerminalIPythonApp
15
15
  from IPython.terminal.prompts import Prompts, Token
16
+ from pydantic import ValidationError
16
17
  from rich.console import Console
17
18
  from rich.panel import Panel
18
19
  from rich.text import Text
@@ -30,6 +31,7 @@ from bec_lib.client import BECClient
30
31
  from bec_lib.logger import bec_logger
31
32
  from bec_lib.redis_connector import RedisConnector
32
33
  from bec_lib.service_config import ServiceConfig
34
+ from bec_lib.utils.pydantic_pretty_print import pretty_print_pydantic_validation_error
33
35
 
34
36
  logger = bec_logger.logger
35
37
 
@@ -213,16 +215,16 @@ class BECIPythonClient:
213
215
  header.append("Alarm Raised\n", style="bold red")
214
216
  header.append(f"Severity: {alarm.severity.name}\n", style="bold")
215
217
  header.append(f"Type: {alarm.alarm_type}\n", style="bold")
216
- if alarm.alarm.source.get("device"):
217
- header.append(f"Device: {alarm.alarm.source['device']}\n", style="bold")
218
+ if alarm.alarm.info.device:
219
+ header.append(f"Device: {alarm.alarm.info.device}\n", style="bold")
218
220
 
219
221
  console.print(Panel(header, title="Alarm Info", border_style="red", expand=False))
220
222
 
221
223
  # --- SHOW SUMMARY
222
- if alarm.alarm.compact_msg:
224
+ if alarm.alarm.info.compact_error_message:
223
225
  console.print(
224
226
  Panel(
225
- Text(alarm.alarm.compact_msg, style="yellow"),
227
+ Text(alarm.alarm.info.compact_error_message, style="yellow"),
226
228
  title="Summary",
227
229
  border_style="yellow",
228
230
  expand=False,
@@ -230,7 +232,7 @@ class BECIPythonClient:
230
232
  )
231
233
 
232
234
  # --- SHOW FULL TRACEBACK
233
- tb_str = alarm.alarm.msg
235
+ tb_str = alarm.alarm.info.error_message
234
236
  if tb_str:
235
237
  try:
236
238
  console.print(tb_str)
@@ -248,6 +250,9 @@ def _ip_exception_handler(
248
250
  evalue.pretty_print()
249
251
  print("For more details, use 'bec.show_last_alarm()'")
250
252
  return
253
+ if issubclass(etype, ValidationError):
254
+ pretty_print_pydantic_validation_error(evalue)
255
+ return
251
256
  if issubclass(etype, (ScanInterruption, DeviceConfigError)):
252
257
  print(f"\x1b[31m {evalue.__class__.__name__}:\x1b[0m {evalue}")
253
258
  return
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_ipython_client"
7
- version = "3.79.0"
7
+ version = "3.81.1"
8
8
  description = "BEC IPython client"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -216,13 +216,13 @@ def test_bec_ipython_client_property_access(ipython_client):
216
216
 
217
217
  def test_bec_ipython_client_show_last_alarm(ipython_client, capsys):
218
218
  client = ipython_client
219
- alarm_msg = messages.AlarmMessage(
220
- severity=Alarms.MAJOR,
221
- alarm_type="TestAlarm",
222
- source={},
223
- msg="This is a test alarm",
224
- compact_msg="Test alarm",
219
+ error_info = messages.ErrorInfo(
220
+ error_message="This is a test alarm",
221
+ compact_error_message="Test alarm",
222
+ exception_type="TestAlarm",
223
+ device=None,
225
224
  )
225
+ alarm_msg = messages.AlarmMessage(severity=Alarms.MAJOR, info=error_info)
226
226
  client.alarm_handler = AlarmHandler(connector=mock.MagicMock())
227
227
  client.alarm_handler.add_alarm(alarm_msg)
228
228
  client._alarm_history.append(
@@ -737,12 +737,12 @@ def test_update_config(bec_ipython_client_fixture):
737
737
  bec = bec_ipython_client_fixture
738
738
  bec.metadata.update({"unit_test": "test_update_config"})
739
739
  demo_config_path = os.path.join(os.path.dirname(configs.__file__), "demo_config.yaml")
740
- config = bec.config._load_config_from_file(demo_config_path)
740
+ config = bec.device_manager.config_helper._load_config_from_file(demo_config_path)
741
741
  config.pop("samx")
742
- bec.config.send_config_request(action="set", config=config)
742
+ bec.device_manager.config_helper.send_config_request(action="set", config=config)
743
743
  assert "samx" not in bec.device_manager.devices
744
- config = bec.config._load_config_from_file(demo_config_path)
745
- bec.config.send_config_request(action="set", config=config)
744
+ config = bec.device_manager.config_helper._load_config_from_file(demo_config_path)
745
+ bec.device_manager.config_helper.send_config_request(action="set", config=config)
746
746
 
747
747
 
748
748
  @pytest.mark.timeout(100)
@@ -322,7 +322,9 @@ def test_config_reload(
322
322
  num_devices = len(bec.device_manager.devices)
323
323
  if raises_error:
324
324
  with pytest.raises(DeviceConfigError):
325
- bec.config.update_session_with_file(runtime_config_file_path)
325
+ bec.config.update_session_with_file(
326
+ runtime_config_file_path, force=True, validate=False
327
+ )
326
328
  if deletes_config:
327
329
  assert len(bec.device_manager.devices) == 0
328
330
  elif disabled_device:
@@ -330,7 +332,7 @@ def test_config_reload(
330
332
  else:
331
333
  assert len(bec.device_manager.devices) == num_devices
332
334
  else:
333
- bec.config.update_session_with_file(runtime_config_file_path)
335
+ bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
334
336
  assert len(bec.device_manager.devices) == 2
335
337
  for dev in disabled_device:
336
338
  assert bec.device_manager.devices[dev].enabled is False
@@ -375,7 +377,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
375
377
  f.write(yaml.dump(config))
376
378
 
377
379
  with pytest.raises(DeviceConfigError):
378
- bec.config.update_session_with_file(runtime_config_file_path)
380
+ bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
379
381
 
380
382
  assert len(bec.device_manager.devices) == 2
381
383
  assert bec.device_manager.devices["eyefoc"].enabled is True
@@ -386,7 +388,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
386
388
  f"e2e_test_hexapod_fail", messages.DeviceStatusMessage(device="hexapod", status=0)
387
389
  )
388
390
 
389
- bec.config.update_session_with_file(runtime_config_file_path)
391
+ bec.config.update_session_with_file(runtime_config_file_path, force=True)
390
392
  assert len(bec.device_manager.devices) == 2
391
393
  assert bec.device_manager.devices["eyefoc"].enabled is True
392
394
  assert bec.device_manager.devices["hexapod"].enabled is True
@@ -412,13 +414,13 @@ def test_config_add_remove_device(bec_client_lib):
412
414
  "readOnly": False,
413
415
  }
414
416
  }
415
- bec.config.send_config_request(action="add", config=config)
417
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
416
418
  with pytest.raises(DeviceConfigError) as config_error:
417
- bec.config.send_config_request(action="add", config=config)
419
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
418
420
  assert config_error.match("Device new_device already exists")
419
421
  assert "new_device" in dev
420
422
 
421
- bec.config.send_config_request(action="remove", config={"new_device": {}})
423
+ bec.device_manager.config_helper.send_config_request(action="remove", config={"new_device": {}})
422
424
  assert "new_device" not in dev
423
425
 
424
426
  device_config_msg = bec.connector.get(MessageEndpoints.device_config())
@@ -429,7 +431,7 @@ def test_config_add_remove_device(bec_client_lib):
429
431
 
430
432
  config["new_device"]["deviceClass"] = "ophyd_devices.doesnt_exist"
431
433
  with pytest.raises(DeviceConfigError) as config_error:
432
- bec.config.send_config_request(action="add", config=config)
434
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
433
435
  assert config_error.match("module 'ophyd_devices' has no attribute 'doesnt_exist'")
434
436
  assert "new_device" not in dev
435
437
  assert "samx" in dev