bec-ipython-client 3.115.1__tar.gz → 3.115.2__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.115.1 → bec_ipython_client-3.115.2}/PKG-INFO +1 -1
  2. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/bec_startup.py +46 -11
  3. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/pyproject.toml +1 -1
  4. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/.gitignore +0 -0
  5. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/__init__.py +0 -0
  6. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/beamline_mixin.py +0 -0
  7. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/bec_magics.py +0 -0
  8. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/__init__.py +0 -0
  9. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/device_progress.py +0 -0
  10. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
  11. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/live_table.py +0 -0
  12. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/move_device.py +0 -0
  13. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/callbacks/utils.py +0 -0
  14. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
  15. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
  16. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
  17. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/main.py +0 -0
  18. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
  19. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
  20. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
  21. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
  22. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/__init__.py +0 -0
  23. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
  24. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/prettytable.py +0 -0
  25. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/progressbar.py +0 -0
  26. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/bec_ipython_client/signals.py +0 -0
  27. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/demo.py +0 -0
  28. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/conftest.py +0 -0
  29. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_beamline_mixins.py +0 -0
  30. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_bec_client.py +0 -0
  31. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_device_progress.py +0 -0
  32. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_ipython_live_updates.py +0 -0
  33. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_live_table.py +0 -0
  34. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_move_callback.py +0 -0
  35. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/client_tests/test_pretty_table.py +0 -0
  36. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/conftest.py +0 -0
  37. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/end-2-end/_ensure_requirements_container.py +0 -0
  38. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/end-2-end/test_procedures_e2e.py +0 -0
  39. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/tests/end-2-end/test_scans_e2e.py +0 -0
  40. {bec_ipython_client-3.115.1 → bec_ipython_client-3.115.2}/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.115.1
3
+ Version: 3.115.2
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
@@ -1,6 +1,5 @@
1
1
  import os
2
2
  import sys
3
- import threading
4
3
 
5
4
  import numpy as np # not needed but always nice to have
6
5
 
@@ -11,13 +10,47 @@ from bec_lib.acl_login import BECAuthenticationError
11
10
  from bec_lib.logger import bec_logger as _bec_logger
12
11
  from bec_lib.redis_connector import RedisConnector as _RedisConnector
13
12
 
14
- try:
15
- from bec_widgets.cli.client_utils import BECGuiClient
16
- except ImportError:
17
- BECGuiClient = None
18
-
19
13
  logger = _bec_logger.logger
20
14
 
15
+
16
+ class _LazyBECGuiClient:
17
+ """Defer BEC Widgets import while preserving the interactive ``gui`` object."""
18
+
19
+ def __init__(self, gui_id: str | None = None):
20
+ self._gui_id = gui_id
21
+ self._client = None
22
+
23
+ def _materialize(self):
24
+ if self._client is None:
25
+ try:
26
+ from bec_widgets.cli.client_utils import BECGuiClient
27
+ except ImportError:
28
+ logger.warning("BEC Widgets is not available; skipping GUI startup.")
29
+ bec.gui = None
30
+ globals().pop("gui", None)
31
+ raise
32
+
33
+ self._client = BECGuiClient()
34
+ if self._gui_id:
35
+ self._client.connect_to_gui_server(self._gui_id)
36
+ bec.gui = self._client
37
+ globals()["gui"] = self._client
38
+ return self._client
39
+
40
+ def __getattr__(self, name):
41
+ return getattr(self._materialize(), name)
42
+
43
+ def __setattr__(self, name, value):
44
+ if name.startswith("_"):
45
+ return super().__setattr__(name, value)
46
+ return setattr(self._materialize(), name, value)
47
+
48
+ def __repr__(self) -> str:
49
+ if self._client is None:
50
+ return "LazyBECGuiClient(uninitialized)"
51
+ return repr(self._client)
52
+
53
+
21
54
  bec = _BECIPythonClient(
22
55
  _main_dict["config"], _RedisConnector, wait_for_server=_main_dict["wait_for_server"]
23
56
  )
@@ -32,12 +65,14 @@ except (BECAuthenticationError, KeyboardInterrupt) as exc:
32
65
  except Exception:
33
66
  sys.excepthook(*sys.exc_info())
34
67
  else:
35
- if bec.started and BECGuiClient is not None:
36
- gui = bec.gui = BECGuiClient()
37
- if _main_dict["args"].gui_id:
38
- gui.connect_to_gui_server(_main_dict["args"].gui_id)
68
+ if bec.started:
69
+ gui = bec.gui = _LazyBECGuiClient(gui_id=_main_dict["args"].gui_id)
39
70
  if not _main_dict["args"].nogui:
40
- gui.show()
71
+ try:
72
+ gui.show()
73
+ except ImportError:
74
+ logger.warning("BEC Widgets is not available")
75
+ pass
41
76
 
42
77
  _available_plugins = plugin_helper.get_ipython_client_startup_plugins(state="post")
43
78
  if _available_plugins:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_ipython_client"
7
- version = "3.115.1"
7
+ version = "3.115.2"
8
8
  description = "BEC IPython client"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [