From dbb4a2b23b827fe334a9b49a5908d32a937dab1f Mon Sep 17 00:00:00 2001
From: PONS <pons@esrf.fr>
Date: Fri, 12 Dec 2025 11:05:27 +0100
Subject: [PATCH 1/4] Added from_dict() method

---
 pyaml/accelerator.py | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/pyaml/accelerator.py b/pyaml/accelerator.py
index f944a8232..3a5ed0360 100644
--- a/pyaml/accelerator.py
+++ b/pyaml/accelerator.py
@@ -108,6 +108,25 @@ def live(self) -> ControlSystem:
     def design(self) -> Simulator:
         return self.__design
 
+    @staticmethod
+    def from_dict(config_dict:dict, ignore_external=False):
+        """
+        Construct an accelerator from a config file.
+        Parameters
+        ----------
+        config_dict : str
+            Dictionnary conatining accelerator config
+        ignore_external: bool
+            Ignore external modules and return None for object that
+            cannot be created. pydantic schema that support that an
+            object is not created should handle None fields.
+
+        """
+        if ignore_external:
+            # control systems are external, so remove controls field
+            config_dict.pop("controls", None)
+        return Factory.depth_first_build(config_dict, ignore_external)
+    
     @staticmethod
     def load(
         filename: str, use_fast_loader: bool = False, ignore_external=False
@@ -135,9 +154,5 @@ def load(
             raise PyAMLConfigException(f"{filename} file not found")
         rootfolder = os.path.abspath(os.path.dirname(filename))
         set_root_folder(rootfolder)
-        config_dict = load(os.path.basename(filename), None, use_fast_loader)
-        if ignore_external:
-            # control systems are external, so remove controls field
-            config_dict.pop("controls", None)
-        aml = Factory.depth_first_build(config_dict, ignore_external)
-        return aml
+        config_dict = load(os.path.basename(filename), None, use_fast_loader)        
+        return Accelerator.from_dict(config_dict)

From 7f427a46e87a8418993b2e85bb65dbd1b08252fc Mon Sep 17 00:00:00 2001
From: PONS <pons@esrf.fr>
Date: Fri, 12 Dec 2025 11:10:30 +0100
Subject: [PATCH 2/4] Fixed formatting

---
 README.md            | 8 ++++----
 pyaml/accelerator.py | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index e4b202fe0..9936884c7 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ If you want to only tests for your machine and not develop, you shouldn't instal
 
 Available packages for bindings:
 
-TANGO: [tango-pyaml](https://github.com/python-accelerator-middle-layer/tango-pyaml)  
+TANGO: [tango-pyaml](https://github.com/python-accelerator-middle-layer/tango-pyaml)
 TANGO or EPICS: [pyaml-cs-oa](https://github.com/python-accelerator-middle-layer/pyaml-cs-oa)
 
 #### Developer Installation
@@ -29,7 +29,7 @@ TANGO or EPICS: [pyaml-cs-oa](https://github.com/python-accelerator-middle-layer
    pip install -e .
    ```
 4. Install the development dependencies and pre-commit hooks
-   
+
    ```
    pip install -e .[dev]
    pre-commit install
@@ -37,9 +37,9 @@ TANGO or EPICS: [pyaml-cs-oa](https://github.com/python-accelerator-middle-layer
 
 5. If you want to try the examples using the control system bindings you also need to install those. See:
 
-   TANGO: [tango-pyaml](https://github.com/python-accelerator-middle-layer/tango-pyaml)  
+   TANGO: [tango-pyaml](https://github.com/python-accelerator-middle-layer/tango-pyaml)
    TANGO or EPICS: [pyaml-cs-oa](https://github.com/python-accelerator-middle-layer/pyaml-cs-oa)
- 
+
 6. If you want to run tests manually using the TANGO bindings without requiring a live machine you can also install the the Dummy TANGO control system available in tests/dummy-cs/tango. It is a simple emulation that allows to check the interface to the control system. The implemented control system doesn't do anything but it is only intended for tests during the development.
 
 
diff --git a/pyaml/accelerator.py b/pyaml/accelerator.py
index 3a5ed0360..05152d020 100644
--- a/pyaml/accelerator.py
+++ b/pyaml/accelerator.py
@@ -109,7 +109,7 @@ def design(self) -> Simulator:
         return self.__design
 
     @staticmethod
-    def from_dict(config_dict:dict, ignore_external=False):
+    def from_dict(config_dict: dict, ignore_external=False):
         """
         Construct an accelerator from a config file.
         Parameters
@@ -126,7 +126,7 @@ def from_dict(config_dict:dict, ignore_external=False):
             # control systems are external, so remove controls field
             config_dict.pop("controls", None)
         return Factory.depth_first_build(config_dict, ignore_external)
-    
+
     @staticmethod
     def load(
         filename: str, use_fast_loader: bool = False, ignore_external=False
@@ -154,5 +154,5 @@ def load(
             raise PyAMLConfigException(f"{filename} file not found")
         rootfolder = os.path.abspath(os.path.dirname(filename))
         set_root_folder(rootfolder)
-        config_dict = load(os.path.basename(filename), None, use_fast_loader)        
+        config_dict = load(os.path.basename(filename), None, use_fast_loader)
         return Accelerator.from_dict(config_dict)

From f418d7df5823e9a471e77aa1623da8cb84ca246d Mon Sep 17 00:00:00 2001
From: PONS <pons@esrf.fr>
Date: Fri, 12 Dec 2025 11:13:43 +0100
Subject: [PATCH 3/4] Added missing type

---
 pyaml/accelerator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyaml/accelerator.py b/pyaml/accelerator.py
index 05152d020..468c4bd7f 100644
--- a/pyaml/accelerator.py
+++ b/pyaml/accelerator.py
@@ -109,7 +109,7 @@ def design(self) -> Simulator:
         return self.__design
 
     @staticmethod
-    def from_dict(config_dict: dict, ignore_external=False):
+    def from_dict(config_dict: dict, ignore_external=False) -> "Accelerator":
         """
         Construct an accelerator from a config file.
         Parameters

From 9cf74c15a2692bd78f087dbf6bb3852b62712b83 Mon Sep 17 00:00:00 2001
From: PONS <pons@esrf.fr>
Date: Fri, 12 Dec 2025 11:36:01 +0100
Subject: [PATCH 4/4] Typo

---
 pyaml/accelerator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyaml/accelerator.py b/pyaml/accelerator.py
index 468c4bd7f..25ebea40a 100644
--- a/pyaml/accelerator.py
+++ b/pyaml/accelerator.py
@@ -111,7 +111,7 @@ def design(self) -> Simulator:
     @staticmethod
     def from_dict(config_dict: dict, ignore_external=False) -> "Accelerator":
         """
-        Construct an accelerator from a config file.
+        Construct an accelerator from a dictionary.
         Parameters
         ----------
         config_dict : str
