Repository: Quantum-Accelerators/quacc
Pull request #1378 (2023-12-16 17:38:39)

Support `local` as `None`


Patch:
diff --git a/docs/user/basics/wflow_syntax.md b/docs/user/basics/wflow_syntax.md
index e4b9b166..10c79997 100644
--- a/docs/user/basics/wflow_syntax.md
+++ b/docs/user/basics/wflow_syntax.md
@@ -82,7 +82,7 @@ To help enable interoperability between workflow engines, quacc offers a unified
 
         Due to the difference in how Jobflow handles workflows compared to other supported workflow engines, any quacc recipes that have been pre-defined with a `#!Python @flow` or `#!Python @subflow` decorator (i.e. have `_flow` in the name) cannot be run directly with Jobflow.
 
-The quacc descriptors are drop-in replacements for the specified workflow engine analogue, which we will use for the remainder of the tutorials. Based on the value for the `WORKFLOW_ENGINE` global variable in your [quacc settings](../settings/settings.md), the appropriate decorator will be automatically selected. If the `WORKFLOW_ENGINE` setting is set to `None`, the decorators will have no effect on the underlying function.
+The quacc descriptors are drop-in replacements for the specified workflow engine analogue, which we will use for the remainder of the tutorials. Based on the value for the `WORKFLOW_ENGINE` global variable in your [quacc settings](../settings/settings.md), the appropriate decorator will be automatically selected. If the `WORKFLOW_ENGINE` setting is set to `None` (i.e. `quacc set WORKFLOW_ENGINE None`), the decorators will have no effect on the underlying function.
 
 ## Simple Workflow
 
diff --git a/docs/user/settings/settings.md b/docs/user/settings/settings.md
index 2c921cd9..db4726a9 100644
--- a/docs/user/settings/settings.md
+++ b/docs/user/settings/settings.md
@@ -15,11 +15,14 @@ If you are planning to modify a given set of parameters for all of your calculat
 ```yaml title="~/.quacc.yaml"
 SCRATCH_DIR: $SCRATCH # (1)!
 CREATE_UNIQUE_DIR: true # (2)!
+WORKFLOW_ENGINE: # (3)!
 ```
 
-1. This would set the quacc scratch directory to the environment variable `$SCRATCH` on whatever machine the calculations are run on.
+1. In YAML, you do not need to put quotation marks around strings. In this case, the quacc scratch directory would be set to the environment variable `$SCRATCH` on whatever machine the calculations are run on.
 
-2. This would ensure that each job in your quacc workflow is stored in a unique, isolated directory.
+2. In YAML, booleans are lowercase. In this case, the setting would ensure that each job in your quacc workflow is stored in a unique, isolated directory.
+
+3. In YAML, a blank value is interpreted as `None` in Python. A value of `null` is equivalent to `None` too. In this case, no workflow engine would be used.
 
 !!! Tip "Command-Line Interface"
 
diff --git a/src/quacc/settings.py b/src/quacc/settings.py
index 86f3ec49..62bae999 100644
--- a/src/quacc/settings.py
+++ b/src/quacc/settings.py
@@ -325,6 +325,14 @@ class QuaccSettings(BaseSettings):
 
     # --8<-- [end:settings]
 
+    @field_validator("WORKFLOW_ENGINE")
+    @classmethod
+    def validate_workflow_engine(cls, v: Optional[str]) -> Optional[str]:
+        """Validate the workflow engine"""
+        if v and v.lower() == "local":
+            return None
+        return v
+
     @field_validator("RESULTS_DIR", "SCRATCH_DIR")
     @classmethod
     def resolve_and_make_paths(cls, v: Optional[Path]) -> Optional[Path]:


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index ab5bbeb2..e3ddbc20 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -76,7 +76,8 @@ jobs:
       - name: Install pip packages
         run: |
           pip install -r tests/requirements.txt
-          pip install -r tests/covalent/requirements-covalent.txt
+          pip install -r tests/requirements-covalent.txt
+          pip install -r tests/phonopy.txt
           pip install .[dev]
 
       - name: Start Covalent server
@@ -120,7 +121,8 @@ jobs:
       - name: Install pip packages
         run: |
           pip install -r tests/requirements.txt
-          pip install -r tests/${{ matrix.wflow_engine }}/requirements-${{ matrix.wflow_engine }}.txt
+          pip install -r tests/requirements-${{ matrix.wflow_engine }}.txt
+          pip install -r tests/phonopy.txt
           pip install .[dev]
 
       - name: Run tests with pytest
diff --git a/tests/README.md b/tests/README.md
index 12958547..1e75a11e 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -20,4 +20,4 @@ pytest tests/parsl # or `pytest .` from within `tests/parsl`
 
 ## Troubleshooting Tests
 
-If you ever need to inspect files from recipes that are generated during a test run, you can find them in the `.quacc_scratch` and `.quacc_results` directories that are created in the current working directory.
+If you ever need to inspect files from a failed test run, you can find them in the `.quacc_scratch` and `.quacc_results` directories that are created in the current working directory.
diff --git a/tests/core/settings/test_settings.py b/tests/core/settings/test_settings.py
index a84f67c3..9a53613a 100644
--- a/tests/core/settings/test_settings.py
+++ b/tests/core/settings/test_settings.py
@@ -32,12 +32,13 @@ def test_file_v1(tmp_path, monkeypatch):
     assert QuaccSettings().GZIP_FILES is True
 
     with open("quacc_test.yaml", "w") as f:
-        f.write("GZIP_FILES: false")
+        f.write("GZIP_FILES: false\nWORKFLOW_ENGINE: local")
     monkeypatch.setenv(
         "QUACC_CONFIG_FILE", os.path.join(os.getcwd(), "quacc_test.yaml")
     )
 
     assert QuaccSettings().GZIP_FILES is False
+    assert QuaccSettings().WORKFLOW_ENGINE is None
     os.remove("quacc_test.yaml")
 
 
diff --git a/tests/covalent/requirements-covalent.txt b/tests/requirements-covalent.txt
similarity index 76%
rename from tests/covalent/requirements-covalent.txt
rename to tests/requirements-covalent.txt
index 8c81e8c0..1b89cd05 100644
--- a/tests/covalent/requirements-covalent.txt
+++ b/tests/requirements-covalent.txt
@@ -1,3 +1,2 @@
 covalent==0.227.0rc0
 covalent-hpc-plugin==0.0.8
-phonopy==2.21.0
\ No newline at end of file
diff --git a/tests/dask/requirements-dask.txt b/tests/requirements-dask.txt
similarity index 75%
rename from tests/dask/requirements-dask.txt
rename to tests/requirements-dask.txt
index cfa72c91..83748371 100644
--- a/tests/dask/requirements-dask.txt
+++ b/tests/requirements-dask.txt
@@ -1,3 +1,2 @@
 dask[distributed]==2023.12.0
 dask-jobqueue==0.8.2
-phonopy==2.21.0
diff --git a/tests/jobflow/requirements-jobflow.txt b/tests/requirements-jobflow.txt
similarity index 100%
rename from tests/jobflow/requirements-jobflow.txt
rename to tests/requirements-jobflow.txt
diff --git a/tests/parsl/requirements-parsl.txt b/tests/requirements-parsl.txt
similarity index 64%
rename from tests/parsl/requirements-parsl.txt
rename to tests/requirements-parsl.txt
index aef36b95..8d37a90b 100644
--- a/tests/parsl/requirements-parsl.txt
+++ b/tests/requirements-parsl.txt
@@ -1,2 +1,2 @@
 parsl[monitoring]==2023.12.4
-phonopy==2.21.0
+phonopy==2.21.