bec-ipython-client 3.128.6__tar.gz → 3.129.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 (42) hide show
  1. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/PKG-INFO +1 -1
  2. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/pyproject.toml +2 -1
  3. bec_ipython_client-3.129.0/tests/end-2-end/test_actors_e2e.py +103 -0
  4. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/.gitignore +0 -0
  5. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/__init__.py +0 -0
  6. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/beamline_mixin.py +0 -0
  7. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/bec_magics.py +0 -0
  8. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/bec_startup.py +0 -0
  9. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/__init__.py +0 -0
  10. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/device_progress.py +0 -0
  11. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
  12. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/live_table.py +0 -0
  13. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/move_device.py +0 -0
  14. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/callbacks/utils.py +0 -0
  15. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
  16. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
  17. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
  18. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/main.py +0 -0
  19. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
  20. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
  21. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
  22. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
  23. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/__init__.py +0 -0
  24. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
  25. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/prettytable.py +0 -0
  26. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/progressbar.py +0 -0
  27. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/bec_ipython_client/signals.py +0 -0
  28. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/demo.py +0 -0
  29. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/conftest.py +0 -0
  30. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_beamline_mixins.py +0 -0
  31. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_bec_client.py +0 -0
  32. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_device_progress.py +0 -0
  33. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_ipython_live_updates.py +0 -0
  34. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_live_table.py +0 -0
  35. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_move_callback.py +0 -0
  36. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/client_tests/test_pretty_table.py +0 -0
  37. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/conftest.py +0 -0
  38. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/end-2-end/_ensure_requirements_container.py +0 -0
  39. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/end-2-end/test_procedures_e2e.py +0 -0
  40. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/end-2-end/test_scans_e2e.py +0 -0
  41. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/end-2-end/test_scans_lib_e2e.py +0 -0
  42. {bec_ipython_client-3.128.6 → bec_ipython_client-3.129.0}/tests/end-2-end/test_scans_v4_lib_e2e.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_ipython_client
3
- Version: 3.128.6
3
+ Version: 3.129.0
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_ipython_client"
7
- version = "3.128.6"
7
+ version = "3.129.0"
8
8
  description = "BEC IPython client"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -76,6 +76,7 @@ Homepage = "https://github.com/bec-project/bec"
76
76
 
77
77
 
78
78
 
79
+
79
80
 
80
81
 
81
82
  [tool.hatch.build.targets.wheel]
@@ -0,0 +1,103 @@
1
+ from __future__ import annotations
2
+
3
+ import time
4
+ from typing import TYPE_CHECKING
5
+
6
+ import pytest
7
+
8
+ from bec_lib.bl_states import DeviceWithinLimitsStateConfig
9
+ from bec_lib.builtin_actor_hli import BuiltinActorHli
10
+ from bec_lib.logger import bec_logger
11
+ from bec_lib.messages import ScanQueueStatus
12
+
13
+ logger = bec_logger.logger
14
+
15
+ if TYPE_CHECKING: # pragma: no cover
16
+ from ophyd_devices.sim.sim_test_devices import SimDeviceWithSignalDelay
17
+
18
+ from bec_ipython_client.main import BECIPythonClient
19
+
20
+
21
+ @pytest.fixture
22
+ def bec_with_delay_device(bec_ipython_client_fixture):
23
+ bec = bec_ipython_client_fixture
24
+ bec.builtin_actors.scan_interlock.enabled = True
25
+ dev = bec.device_manager.devices
26
+ dev.ramp_up.min_val.put(0)
27
+ dev.ramp_up.max_val.put(400)
28
+ dev.ramp_up.value.put(400)
29
+ dev.ramp_up.delay.put(2)
30
+ dev.ramp_up.rampup_time.put(2)
31
+ yield bec, dev.ramp_up
32
+ dev.ramp_up.stop()
33
+
34
+
35
+ @pytest.fixture
36
+ def ramp_up_bl_state(bec_with_delay_device):
37
+ bec, _ = bec_with_delay_device
38
+ ramp_up_state_config = DeviceWithinLimitsStateConfig(
39
+ name="beam_intensity_sufficient", device="ramp_up", low_limit=200
40
+ )
41
+ bec.beamline_states.add(ramp_up_state_config)
42
+ yield bec_with_delay_device
43
+ bec.beamline_states.delete("beam_intensity_sufficient")
44
+ bec.builtin_actors.scan_interlock.clear_all()
45
+
46
+
47
+ def _wait_for(pred, timeout=10, retries=100):
48
+ for i in range(retries):
49
+ if pred():
50
+ return True
51
+ time.sleep(timeout / retries)
52
+ return pred()
53
+
54
+
55
+ # pylint: disable=protected-accesstest
56
+ @pytest.mark.timeout(100)
57
+ def test_scan_interlock(
58
+ ramp_up_bl_state: tuple[BECIPythonClient, SimDeviceWithSignalDelay], bec_with_delay_device
59
+ ):
60
+ bec, ramp_up = ramp_up_bl_state
61
+ actors: BuiltinActorHli = bec.builtin_actors
62
+ assert bec.beamline_states.beam_intensity_sufficient.get()["status"] == "valid"
63
+ assert actors.scan_interlock.enabled
64
+ current_q_status_msg: ScanQueueStatus = bec.queue.queue_storage.current_scan_queue["primary"]
65
+ assert current_q_status_msg.status == "RUNNING"
66
+ actors.scan_interlock.add_state_to_interlock("beam_intensity_sufficient", "valid")
67
+
68
+ assert _wait_for(lambda: "beam_intensity_sufficient" in actors.scan_interlock.states_watched)
69
+
70
+ def _beam_down():
71
+ return (ramp_up.value.get() < 200) and bec.beamline_states.beam_intensity_sufficient.get()[
72
+ "status"
73
+ ] == "invalid"
74
+
75
+ def _beam_up():
76
+ return (ramp_up.value.get() > 200) and bec.beamline_states.beam_intensity_sufficient.get()[
77
+ "status"
78
+ ] == "valid"
79
+
80
+ ramp_up.start.set(1)
81
+ scan = bec.scans.line_scan(
82
+ "samx", -5, 5, steps=10, exp_time=0.5, relative=False, hide_report=True
83
+ )
84
+
85
+ assert _wait_for(_beam_down)
86
+ assert _wait_for(
87
+ lambda: bec.queue.queue_storage.current_scan_queue["primary"].status == "LOCKED"
88
+ )
89
+ assert scan.status == "STOPPED"
90
+ assert _wait_for(_beam_up)
91
+ assert _wait_for(
92
+ lambda: bec.queue.queue_storage.current_scan_queue["primary"].status == "RUNNING"
93
+ )
94
+
95
+ def second_scan_has_run():
96
+ if len(bec.history) < 2:
97
+ return False
98
+ return (
99
+ bec.history[-2].metadata["bec"]["status"] == "aborted"
100
+ and bec.history[-1].metadata["bec"]["status"] == "closed"
101
+ )
102
+
103
+ assert _wait_for(second_scan_has_run)