bec-ipython-client 3.121.0__tar.gz → 3.122.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 (41) hide show
  1. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/PKG-INFO +1 -1
  2. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/pyproject.toml +3 -1
  3. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_procedures_e2e.py +4 -2
  4. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_v4_lib_e2e.py +83 -0
  5. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/.gitignore +0 -0
  6. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/__init__.py +0 -0
  7. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/beamline_mixin.py +0 -0
  8. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/bec_magics.py +0 -0
  9. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/bec_startup.py +0 -0
  10. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/__init__.py +0 -0
  11. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/device_progress.py +0 -0
  12. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
  13. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/live_table.py +0 -0
  14. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/move_device.py +0 -0
  15. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/utils.py +0 -0
  16. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
  17. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
  18. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
  19. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/main.py +0 -0
  20. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
  21. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
  22. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
  23. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
  24. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/__init__.py +0 -0
  25. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
  26. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/prettytable.py +0 -0
  27. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/progressbar.py +0 -0
  28. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/signals.py +0 -0
  29. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/demo.py +0 -0
  30. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/conftest.py +0 -0
  31. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_beamline_mixins.py +0 -0
  32. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_bec_client.py +0 -0
  33. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_device_progress.py +0 -0
  34. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_ipython_live_updates.py +0 -0
  35. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_live_table.py +0 -0
  36. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_move_callback.py +0 -0
  37. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_pretty_table.py +0 -0
  38. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/conftest.py +0 -0
  39. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/_ensure_requirements_container.py +0 -0
  40. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_e2e.py +0 -0
  41. {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_lib_e2e.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_ipython_client
3
- Version: 3.121.0
3
+ Version: 3.122.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.121.0"
7
+ version = "3.122.0"
8
8
  description = "BEC IPython client"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -46,6 +46,8 @@ Homepage = "https://github.com/bec-project/bec"
46
46
 
47
47
 
48
48
 
49
+
50
+
49
51
  [tool.hatch.build.targets.wheel]
50
52
  include = ["*"]
51
53
 
@@ -46,8 +46,10 @@ def client_logtool_and_manager(
46
46
  manager = ProcedureManager(
47
47
  f"{client.connector.host}:{client.connector.port}", ContainerProcedureWorker
48
48
  )
49
- yield client, logtool, manager
50
- manager.shutdown()
49
+ try:
50
+ yield client, logtool, manager
51
+ finally:
52
+ manager.shutdown()
51
53
 
52
54
 
53
55
  def _wait_while(cond: Callable[[], bool], timeout_s):
@@ -1,10 +1,17 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import time
4
+ import uuid
5
+ from pathlib import Path
6
+ from unittest.mock import patch
4
7
 
5
8
  import numpy as np
6
9
  import pytest
10
+ from typer.testing import CliRunner
7
11
 
12
+ from bec_lib.endpoints import MessageEndpoints
13
+ from bec_lib.plugin_helper import plugin_repo_path
14
+ from bec_lib.utils.plugin_manager import create as plugin_create
8
15
  from bec_server.scan_server.scans import position_generators
9
16
 
10
17
 
@@ -81,6 +88,38 @@ def _wait_for_queue_status(bec, queue_name: str, expected_status: str, timeout:
81
88
  raise TimeoutError(f"Timed out waiting for queue status {expected_status!r}.")
82
89
 
83
90
 
91
+ def _plugin_scan_paths(scan_name: str) -> tuple[Path, Path]:
92
+ repo = Path(plugin_repo_path())
93
+ scans_dir = repo / repo.name / "scans"
94
+ return scans_dir / f"{scan_name}.py", scans_dir / "__init__.py"
95
+
96
+
97
+ def _remove_scan_export(init_file: Path, scan_name: str):
98
+ import_line = (
99
+ f"from .{scan_name} import {''.join(part.capitalize() for part in scan_name.split('_'))}\n"
100
+ )
101
+ if not init_file.exists():
102
+ return
103
+ content = init_file.read_text(encoding="utf-8")
104
+ if import_line not in content:
105
+ return
106
+ init_file.write_text(content.replace(import_line, ""), encoding="utf-8")
107
+
108
+
109
+ def _wait_for_v4_scan_registration(bec, scan_name: str, timeout: float = 60):
110
+ deadline = time.time() + timeout
111
+ while time.time() < deadline:
112
+ available_scans = bec.connector.get(MessageEndpoints.available_scans())
113
+ if available_scans and scan_name in available_scans.resource:
114
+ if hasattr(bec.scans, scan_name):
115
+ return getattr(bec.scans, scan_name)
116
+ time.sleep(1)
117
+ available_scans = dir(bec.scans)
118
+ raise TimeoutError(
119
+ f"Timed out waiting for scan {scan_name!r} to become available. Available scans: {available_scans}"
120
+ )
121
+
122
+
84
123
  @pytest.mark.timeout(120)
85
124
  @pytest.mark.parametrize(
86
125
  ("scan_name", "scan_args", "scan_kwargs", "expected_num_points", "expected_num_readouts"),
@@ -279,3 +318,47 @@ def test_v4_scan_lib_stop_resolves_cleanly(bec_client_lib):
279
318
  status.cancel()
280
319
 
281
320
  _wait_for_queue_status(bec, "primary", "RUNNING", timeout=15)
321
+
322
+
323
+ @pytest.mark.timeout(180)
324
+ def test_v4_generated_scan_e2e(bec_client_lib):
325
+ bec = bec_client_lib
326
+ scan_name = f"e2e_generated_scan_{uuid.uuid4().hex[:8]}"
327
+ try:
328
+ scan_file, init_file = _plugin_scan_paths(scan_name)
329
+ except ValueError as exc:
330
+ pytest.skip(f"Generated scan e2e requires an editable plugin install: {exc}")
331
+ runner = CliRunner()
332
+
333
+ try:
334
+ with (
335
+ patch("bec_lib.utils.plugin_manager.create.scan.run_formatters"),
336
+ patch(
337
+ "bec_lib.utils.plugin_manager.create.scan._select_option",
338
+ return_value="SOFTWARE_TRIGGERED",
339
+ ),
340
+ ):
341
+ result = runner.invoke(
342
+ plugin_create._app,
343
+ ["scan", scan_name],
344
+ input="E2E generated scan.\nE2E generated scan.\nn\nn\n",
345
+ )
346
+ assert result.exit_code == 0, result.output
347
+ assert scan_file.exists()
348
+
349
+ bec._request_scan_reload()
350
+ scan_runner = _wait_for_v4_scan_registration(bec, scan_name)
351
+
352
+ bec.metadata.update({"unit_test": "test_v4_generated_scan_e2e"})
353
+ status = scan_runner()
354
+ status.wait(timeout=60, num_points=False, file_written=True)
355
+
356
+ assert status.scan is not None
357
+ assert status.request is not None
358
+ assert status.request.request.content["scan_type"] == scan_name
359
+ finally:
360
+ if scan_file.exists():
361
+ scan_file.unlink()
362
+ _remove_scan_export(init_file, scan_name)
363
+ bec._request_scan_reload()
364
+ time.sleep(2)