cgse-common 0.17.3__tar.gz → 0.18.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 (46) hide show
  1. {cgse_common-0.17.3 → cgse_common-0.18.0}/.gitignore +6 -1
  2. {cgse_common-0.17.3 → cgse_common-0.18.0}/PKG-INFO +1 -1
  3. {cgse_common-0.17.3 → cgse_common-0.18.0}/pyproject.toml +1 -1
  4. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/device.py +71 -1
  5. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/env.py +1 -1
  6. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/hk.py +2 -2
  7. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/log.py +10 -0
  8. cgse_common-0.18.0/src/egse/scpi.py +582 -0
  9. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/setup.py +7 -4
  10. cgse_common-0.18.0/src/egse/socketdevice.py +379 -0
  11. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/system.py +6 -1
  12. cgse_common-0.17.3/src/egse/scpi.py +0 -323
  13. {cgse_common-0.17.3 → cgse_common-0.18.0}/README.md +0 -0
  14. {cgse_common-0.17.3 → cgse_common-0.18.0}/justfile +0 -0
  15. {cgse_common-0.17.3 → cgse_common-0.18.0}/noxfile.py +0 -0
  16. {cgse_common-0.17.3 → cgse_common-0.18.0}/service_registry.db +0 -0
  17. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/__init__.py +0 -0
  18. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/cgse.py +0 -0
  19. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/cgse_common/settings.yaml +0 -0
  20. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/bits.py +0 -0
  21. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/calibration.py +0 -0
  22. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/config.py +0 -0
  23. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/counter.py +0 -0
  24. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/decorators.py +0 -0
  25. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/dicts.py +0 -0
  26. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/exceptions.py +0 -0
  27. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/heartbeat.py +0 -0
  28. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/metrics.py +0 -0
  29. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/observer.py +0 -0
  30. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/obsid.py +0 -0
  31. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/persistence.py +0 -0
  32. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/plugin.py +0 -0
  33. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/plugins/metrics/influxdb.py +0 -0
  34. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/process.py +0 -0
  35. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/py.typed +0 -0
  36. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/randomwalk.py +0 -0
  37. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/reload.py +0 -0
  38. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/resource.py +0 -0
  39. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/response.py +0 -0
  40. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/settings.py +0 -0
  41. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/settings.yaml +0 -0
  42. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/signal.py +0 -0
  43. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/state.py +0 -0
  44. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/task.py +0 -0
  45. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/version.py +0 -0
  46. {cgse_common-0.17.3 → cgse_common-0.18.0}/src/egse/zmq_ser.py +0 -0
@@ -22,9 +22,14 @@ dist
22
22
  .nox
23
23
  htmlcov
24
24
 
25
- # Virtual environments
25
+ # dotenv, ignore all but the example file
26
26
 
27
27
  .env
28
+ .env.*
29
+ !.env.example
30
+
31
+ # Virtual environments
32
+
28
33
  .venv
29
34
  venv
30
35
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cgse-common
3
- Version: 0.17.3
3
+ Version: 0.18.0
4
4
  Summary: Software framework to support hardware testing
5
5
  Author: IvS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cgse-common"
3
- version = "0.17.3"
3
+ version = "0.18.0"
4
4
  description = "Software framework to support hardware testing"
5
5
  authors = [
6
6
  {name = "IvS KU Leuven"}
@@ -54,7 +54,7 @@ class DeviceControllerError(DeviceError):
54
54
  super().__init__(device_name, message)
55
55
 
56
56
 
57
- class DeviceConnectionError(DeviceError):
57
+ class DeviceConnectionError(DeviceError, ConnectionError):
58
58
  """A generic error for all connection type of problems.
59
59
 
60
60
  Args:
@@ -339,6 +339,76 @@ class AsyncDeviceTransport:
339
339
  return await self.trans(command)
340
340
 
341
341
 
342
+ class AsyncDeviceConnectionInterface(DeviceConnectionObservable):
343
+ """Generic connection interface for all Device classes and Controllers.
344
+
345
+ This interface shall be implemented in the Controllers that directly connect to the
346
+ hardware, but also in the simulators to guarantee an identical interface as the controllers.
347
+
348
+ This interface will be implemented in the Proxy classes through the
349
+ YAML definitions. Therefore, the YAML files shall define at least
350
+ the following commands: `connect`, `disconnect`, `reconnect`, `is_connected`.
351
+ """
352
+
353
+ def __init__(self):
354
+ super().__init__()
355
+
356
+ def __enter__(self):
357
+ self.connect()
358
+ return self
359
+
360
+ def __exit__(self, exc_type, exc_val, exc_tb):
361
+ self.disconnect()
362
+
363
+ async def connect(self) -> None:
364
+ """Connect to the device controller.
365
+
366
+ Raises:
367
+ ConnectionError: when the connection can not be opened.
368
+ """
369
+
370
+ raise NotImplementedError
371
+
372
+ async def disconnect(self) -> None:
373
+ """Disconnect from the device controller.
374
+
375
+ Raises:
376
+ ConnectionError: when the connection can not be closed.
377
+ """
378
+ raise NotImplementedError
379
+
380
+ async def reconnect(self):
381
+ """Reconnect the device controller.
382
+
383
+ Raises:
384
+ ConnectionError: when the device can not be reconnected for some reason.
385
+ """
386
+ raise NotImplementedError
387
+
388
+ async def is_connected(self) -> bool:
389
+ """Check if the device is connected.
390
+
391
+ Returns:
392
+ True if the device is connected and responds to a command, False otherwise.
393
+ """
394
+ raise NotImplementedError
395
+
396
+
397
+ class AsyncDeviceInterface(AsyncDeviceConnectionInterface):
398
+ """A generic interface for all device classes."""
399
+
400
+ def is_simulator(self) -> bool:
401
+ """Checks whether the device is a simulator rather than a real hardware controller.
402
+
403
+ This can be useful for testing purposes or when doing actual movement simulations.
404
+
405
+ Returns:
406
+ True if the Device is a Simulator; False if the Device is connected to real hardware.
407
+ """
408
+
409
+ raise NotImplementedError
410
+
411
+
342
412
  class DeviceFactoryInterface:
343
413
  """
344
414
  Base class for creating a device factory class to access devices.
@@ -170,7 +170,7 @@ def setup_env():
170
170
  return
171
171
 
172
172
  if VERBOSE_DEBUG:
173
- logger.debug(f"Initialising the environment...")
173
+ logger.debug("Initializing the environment...")
174
174
 
175
175
  load_dotenv()
176
176
 
@@ -51,8 +51,8 @@ class TmDictionaryColumns(str, Enum):
51
51
  """ # noqa
52
52
 
53
53
  STORAGE_MNEMONIC = "Storage mnemonic"
54
- CORRECT_HK_NAMES = "CAM EGSE mnemonic"
55
- ORIGINAL_EGSE_HK_NAMES = "Original name in EGSE"
54
+ CORRECT_HK_NAMES = "CGSE mnemonic"
55
+ ORIGINAL_EGSE_HK_NAMES = "Original name in CGSE"
56
56
  SYNOPTICS_ORIGIN = f"Origin of synoptics at {get_site_id()}"
57
57
  TIMESTAMP_NAMES = "Name of corresponding timestamp"
58
58
  DESCRIPTION = "Description"
@@ -131,6 +131,16 @@ for handler in root_logger.handlers:
131
131
  handler.addFilter(NonEGSEFilter())
132
132
  handler.addFilter(PackageFilter())
133
133
 
134
+ # Optional: integrate with Textual logging if available
135
+ #
136
+ # try:
137
+ # from textual.logging import TextualHandler
138
+
139
+ # root_logger.addHandler(TextualHandler())
140
+ # except ImportError:
141
+ # pass
142
+
143
+
134
144
  logger = egse_logger
135
145
 
136
146
  if __name__ == "__main__":