Skip to content

Add option to disable the control system when loading a PyAML file #26

@gupichon

Description

@gupichon

Description:
It should be possible to disable the control system when loading a PyAML file.
This would allow users to load and inspect the configuration (e.g. design, devices, hierarchy) without requiring a live connection to Tango or any other control system backend.

Motivation / Use case:
Enable offline analysis or validation of PyAML files.
Facilitate unit testing without requiring a running control system.
Simplify workflows for configuration editing or inspection tools.

Proposed behavior:
Add an optional flag such as enable_control_system: bool = True (default True) to the PyAML loader or configuration.
When disabled (False), no DeviceProxy, AttributeProxy, or control-system-related initialization should be performed.
The corresponding live section or ControlSystem objects should remain accessible but inactive (e.g., mock or empty implementations).

Example:

from pyaml import PyAML

ml = PyAML("machine.yaml", enable_control_system=False)
sr = ml.get("sr")

# The design tree can still be accessed
print(sr.design.get_magnet("QF1A-C01"))

# But control system operations are disabled
sr.live.get_magnet("QF1A-C01").hardware.set(1.0)  # Should raise or be a no-op

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions