Skip to content

Commit

Permalink
Switch from intelligent save to intelligent load
Browse files Browse the repository at this point in the history
Use the concept of Settings that can be:
- Created from a Device
- Stored to YAML
- Retrieved from YAML
- Added to other Settings
- Applied to a Device
  • Loading branch information
coretl committed Dec 9, 2024
1 parent d70234f commit 820735b
Show file tree
Hide file tree
Showing 24 changed files with 711 additions and 755 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ docs/savefig
# generated version number
ophyd_async/_version.py


# ruff cache
.ruff_cache/

# import linter cache
.import_linter_cache/
50 changes: 16 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ lint.select = [
"SLF", # self - https://docs.astral.sh/ruff/settings/#lintflake8-self
"PLC2701", # private import - https://docs.astral.sh/ruff/rules/import-private-name/
]
lint.ignore = [
"B901", # Return in a generator is needed for plans
]
lint.preview = true # so that preview mode PLC2701 is enabled

[tool.ruff.lint.per-file-ignores]
Expand All @@ -172,47 +175,26 @@ lint.preview = true # so that preview mode PLC2701 is enabled
root_package = "ophyd_async"

[[tool.importlinter.contracts]]
name = "Core is independent"
type = "independence"
modules = "ophyd_async.core"
name = "All runtime modules are in layers"
type = "layers"
containers = ["ophyd_async"]
layers = ["plan_stubs", "fastcs", "epics | tango | sim", "core"]
exhaustive = true
exhaustive_ignores = ["testing", "_version", "__main__"]

[[tool.importlinter.contracts]]
name = "Epics depends only on core"
type = "forbidden"
source_modules = "ophyd_async.epics"
forbidden_modules = [
"ophyd_async.fastcs",
"ophyd_async.plan_stubs",
"ophyd_async.sim",
"ophyd_async.tango",
]
name = "Testing modules"
type = "layers"
containers = ["ophyd_async"]
layers = ["testing", "core"]

[[tool.importlinter.contracts]]
name = "tango depends only on core"
name = "Testing modules are not used at runtime"
type = "forbidden"
source_modules = "ophyd_async.tango"
source_modules = "ophyd_async.testing"
forbidden_modules = [
"ophyd_async.epics",
"ophyd_async.fastcs",
"ophyd_async.plan_stubs",
"ophyd_async.sim",
]


[[tool.importlinter.contracts]]
name = "sim depends only on core"
type = "forbidden"
source_modules = "ophyd_async.sim"
forbidden_modules = [
"ophyd_async.epics",
"ophyd_async.fastcs",
"ophyd_async.plan_stubs",
"ophyd_async.epics",
"ophyd_async.tango",
]


[[tool.importlinter.contracts]]
name = "Fastcs depends only on core, epics, tango"
type = "forbidden"
source_modules = "ophyd_async.fastcs"
forbidden_modules = ["ophyd_async.plan_stubs", "ophyd_async.sim"]
27 changes: 9 additions & 18 deletions src/ophyd_async/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
)
from ._device import Device, DeviceCollector, DeviceConnector, DeviceVector
from ._device_filler import DeviceFiller
from ._device_save_loader import (
all_at_once,
get_signal_values,
load_device,
load_from_yaml,
save_device,
save_to_yaml,
set_signal_values,
walk_rw_signals,
)
from ._flyer import FlyerController, StandardFlyer
from ._hdf_dataset import HDFDataset, HDFFile
from ._log import config_ophyd_async_logging
Expand All @@ -41,6 +31,7 @@
StandardReadable,
StandardReadableFormat,
)
from ._settings import Settings, SettingsProvider
from ._signal import (
Signal,
SignalConnector,
Expand All @@ -55,9 +46,11 @@
soft_signal_r_and_setter,
soft_signal_rw,
wait_for_value,
walk_rw_signals,
)
from ._signal_backend import (
Array1D,
DTypeScalar_co,
SignalBackend,
SignalDatatype,
SignalDatatypeT,
Expand All @@ -84,6 +77,7 @@
in_micros,
wait_for_connection,
)
from ._yaml_settings import YamlSettingsProvider

__all__ = [
"DetectorController",
Expand All @@ -96,14 +90,6 @@
"DeviceCollector",
"DeviceVector",
"DeviceFiller",
"all_at_once",
"get_signal_values",
"load_device",
"load_from_yaml",
"save_device",
"save_to_yaml",
"set_signal_values",
"walk_rw_signals",
"StandardFlyer",
"FlyerController",
"HDFDataset",
Expand All @@ -128,6 +114,8 @@
"HintedSignal",
"StandardReadable",
"StandardReadableFormat",
"Settings",
"SettingsProvider",
"Signal",
"SignalConnector",
"SignalR",
Expand All @@ -141,7 +129,9 @@
"soft_signal_r_and_setter",
"soft_signal_rw",
"wait_for_value",
"walk_rw_signals",
"Array1D",
"DTypeScalar_co",
"SignalBackend",
"make_datakey",
"StrictEnum",
Expand All @@ -168,4 +158,5 @@
"in_micros",
"wait_for_connection",
"completed_status",
"YamlSettingsProvider",
]
Loading

0 comments on commit 820735b

Please sign in to comment.