diff --git a/.github/workflows/python-tests-consolidated.yaml b/.github/workflows/python-tests-consolidated.yaml index fb420d8c..1b164db1 100644 --- a/.github/workflows/python-tests-consolidated.yaml +++ b/.github/workflows/python-tests-consolidated.yaml @@ -14,7 +14,7 @@ jobs: name: Setup and install Ard strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -51,7 +51,7 @@ jobs: needs: setup-install strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -91,7 +91,7 @@ jobs: needs: test-unit strategy: matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -154,7 +154,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest @@ -235,7 +235,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + python-version: [3.11, 3.13] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] include: - os: ubuntu-latest diff --git a/ard/api/interface.py b/ard/api/interface.py index 73ec9032..22ac5792 100644 --- a/ard/api/interface.py +++ b/ard/api/interface.py @@ -165,10 +165,10 @@ def set_up_system_recursive( # Add subsystems directly from the input dictionary if hasattr(parent_group, "name") and (parent_group.name != ""): print( - f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name} to {parent_group.name}." + f"{''.join(' ' * 4 * _depth)}Adding {system_name} to {parent_group.name}." ) else: - print(f"{''.join(['\t' for _ in range(_depth)])}Adding {system_name}.") + print(f"{''.join(' ' * 4 * _depth)}Adding {system_name}.") if "systems" in input_dict: # Recursively add nested subsystems] if _depth > 0: group = parent_group.add_subsystem( @@ -188,7 +188,8 @@ def set_up_system_recursive( _depth=_depth + 1, ) if "approx_totals" in input_dict: - print(f"\tActivating approximate totals on {system_name}") + prefix = "\t" + print(prefix + f"Activating approximate totals on {system_name}") group.approx_totals(**input_dict["approx_totals"]) else: diff --git a/ard/collection/optiwindnet_wrap.py b/ard/collection/optiwindnet_wrap.py index fad464a1..649c2903 100644 --- a/ard/collection/optiwindnet_wrap.py +++ b/ard/collection/optiwindnet_wrap.py @@ -57,11 +57,17 @@ def _own_L_from_inputs(inputs: dict, discrete_inputs: dict) -> nx.Graph: for idx, dxy in enumerate(adjustments[:T, :]): if np.sum(dxy != 0) == 0: continue - warn_string += f"\n\tadjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}" + warn_string += ( + "\n\t" + + f"adjusting turbine #{idx} from {VertexCTR[idx, :]} to {VertexCTR[idx, :] + dxy}" + ) for idx, dxy in enumerate((adjustments[-R:, :])[::-1, :]): if np.sum(dxy != 0) == 0: continue - warn_string += f"\n\tadjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}" + warn_string += ( + "\n\t" + + f"adjusting substation #{idx} from {VertexCTR[-(idx+1), :]} to {VertexCTR[-(idx+1), :] + dxy}" + ) # output the final warning warn(warn_string) diff --git a/ard/utils/logging.py b/ard/utils/logging.py index 9d6a0da0..636c7049 100644 --- a/ard/utils/logging.py +++ b/ard/utils/logging.py @@ -198,7 +198,8 @@ def wrapper(*args, **kwargs): output = sys.stdout.getvalue() sys.stdout = old_stdout - tabset = "".join(["\t" for t in range(tabs)]) + prefix = "\t" + tabset = "".join([prefix for t in range(tabs)]) if output: for line in output.splitlines(): print(f"{tabset}{line}") diff --git a/ard/utils/test_utils.py b/ard/utils/test_utils.py index 058d9280..57178066 100644 --- a/ard/utils/test_utils.py +++ b/ard/utils/test_utils.py @@ -48,11 +48,13 @@ def pyrite_validator( if not validation_matches: print(f"for variable {k}:", file=sys.stderr) + prefix = "\t" print( - f"\t{sum_isclose} values match of {vd_size} total validation values", + prefix + + f"{sum_isclose} values match of {vd_size} total validation values", file=sys.stderr, ) - print(f"\tto a tolerance of {rtol_val:e}", file=sys.stderr) + print(prefix + f"to a tolerance of {rtol_val:e}", file=sys.stderr) print(f"pyrite data for {k}: {v}", file=sys.stderr) print( f"computed data for {k}: {data_for_validation[k]}", file=sys.stderr diff --git a/docs/_config.yml b/docs/_config.yml index 93b1a083..cce165b0 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -13,8 +13,7 @@ copyright: '2024' # See https://jupyterbook.org/content/execute.html execute: execute_notebooks: auto - timeout: 180 - # timeout: 420 # Give each notebook cell 7 minutes to execute + timeout: 420 # Give each notebook cell 7 minutes to execute # Define the name of the latex output file for PDF builds latex: diff --git a/docs/intro.md b/docs/intro.md index 3a584e85..0cd7599a 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -59,4 +59,4 @@ The components that achieve this can be assembled to either run a single top-dow --- -Copyright © 2024, Alliance for Sustainable Energy, LLC +Copyright © 2024, Alliance for Sustainable Energy, LLC diff --git a/pyproject.toml b/pyproject.toml index 024e5919..693c8571 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ include = ["ard", "ard.*"] [project] name = "ard-nrel" -version = "0.1.0-beta2" +version = "0.1.0-beta4" authors = [ {name = "Cory Frontin", email = "cory.frontin@nrel.gov"}, {name = "Rafael Mudafort", email = "rafael.mudafort@nrel.gov"}, @@ -40,7 +40,7 @@ classifiers = [ dependencies = [ "numpy", "floris>=4.3", - "wisdem>=4.0.5", + "wisdem==4.0.5", "NLopt", "marmot-agents", "openmdao", @@ -63,7 +63,7 @@ dev = [ ] docs = [ "pyxdsm", - "jupyter-book", + "jupyter-book<2.0", "sphinx-book-theme", "sphinx-autodoc-typehints", ] diff --git a/test/ard/unit/cost/test_orbit_wrap.py b/test/ard/unit/cost/test_orbit_wrap.py index 2e6e8766..437141d9 100644 --- a/test/ard/unit/cost/test_orbit_wrap.py +++ b/test/ard/unit/cost/test_orbit_wrap.py @@ -378,8 +378,8 @@ def test_baseline_farm(self, subtests): prob.run_model() - bos_capex = float(prob.get_val("orbit.bos_capex", units="MUSD")) - total_capex = float(prob.get_val("orbit.total_capex", units="MUSD")) + bos_capex = float(prob.get_val("orbit.bos_capex", units="MUSD")[0]) + total_capex = float(prob.get_val("orbit.total_capex", units="MUSD")[0]) bos_capex_ref = 477.3328175080761 total_capex_ref = 727.9128175080762 @@ -581,8 +581,8 @@ def test_baseline_farm(self, subtests): self.prob.run_model() - bos_capex = float(self.prob.get_val("orbit.bos_capex", units="MUSD")) - total_capex = float(self.prob.get_val("orbit.total_capex", units="MUSD")) + bos_capex = float(self.prob.get_val("orbit.bos_capex", units="MUSD")[0]) + total_capex = float(self.prob.get_val("orbit.total_capex", units="MUSD")[0]) bos_capex_ref = 477.3328175080761 total_capex_ref = 727.9128175080762 diff --git a/test/conftest.py b/test/conftest.py index 9114d9a2..80f5bd4f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,3 +1,4 @@ +import os from pathlib import Path @@ -6,9 +7,10 @@ def pytest_sessionfinish(session, exitstatus): # for each tempdir for pytest_out_dir in Path().glob("pytest*_out"): - for root, dirs, files in pytest_out_dir.walk( - top_down=False + for root, dirs, files in os.walk( + pytest_out_dir, topdown=False ): # walk the directory + root = Path(root) for name in files: (root / name).unlink() # remove subdirectory files, and for name in dirs: