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.
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/PKG-INFO +1 -1
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/pyproject.toml +3 -1
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_procedures_e2e.py +4 -2
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_v4_lib_e2e.py +83 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/.gitignore +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/beamline_mixin.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/bec_magics.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/bec_startup.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/device_progress.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/live_table.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/move_device.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/utils.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/main.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/__init__.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/prettytable.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/progressbar.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/signals.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/demo.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/conftest.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_beamline_mixins.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_bec_client.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_device_progress.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_ipython_live_updates.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_live_table.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_move_callback.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_pretty_table.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/conftest.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/_ensure_requirements_container.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_e2e.py +0 -0
- {bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_lib_e2e.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bec_ipython_client"
|
|
7
|
-
version = "3.
|
|
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
|
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_procedures_e2e.py
RENAMED
|
@@ -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
|
-
|
|
50
|
-
|
|
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):
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_v4_lib_e2e.py
RENAMED
|
@@ -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)
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/beamline_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/live_table.py
RENAMED
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/callbacks/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/__init__.py
RENAMED
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/SLS/sls_info.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/bec_ipython_client/plugins/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_beamline_mixins.py
RENAMED
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_bec_client.py
RENAMED
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_device_progress.py
RENAMED
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_live_table.py
RENAMED
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_move_callback.py
RENAMED
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/client_tests/test_pretty_table.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bec_ipython_client-3.121.0 → bec_ipython_client-3.122.0}/tests/end-2-end/test_scans_lib_e2e.py
RENAMED
|
File without changes
|