From d84e84372278ecafaf08b1b018ccf6b18a091de9 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 12 May 2025 10:26:22 -0400 Subject: [PATCH 1/7] (prep to) liberate python 3.13 (#69) * liberate python 3.13 * actually liberate python * update testing * version number inequality fix * walkback python for backdated wisdem * propogate to tests --- .github/workflows/python-tests-system.yml | 17 ++++++++++------- .github/workflows/python-tests-unit.yml | 19 ++++++++++--------- pyproject.toml | 1 + 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-tests-system.yml b/.github/workflows/python-tests-system.yml index 7827be63..5bb188da 100644 --- a/.github/workflows/python-tests-system.yml +++ b/.github/workflows/python-tests-system.yml @@ -3,25 +3,28 @@ name: Python System Tests with Coverage on: push: branches: - - main - - develop + - '*' pull_request: branches: - - main - - develop + - '*' jobs: test: - runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + # python-version: [3.13, 3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | diff --git a/.github/workflows/python-tests-unit.yml b/.github/workflows/python-tests-unit.yml index 0b9110d6..172ffe8a 100644 --- a/.github/workflows/python-tests-unit.yml +++ b/.github/workflows/python-tests-unit.yml @@ -3,25 +3,27 @@ name: Python Unit Tests with Coverage on: push: branches: - - main - - develop + - '*' pull_request: branches: - - main - - develop + - '*' jobs: test: - runs-on: ubuntu-latest - + strategy: + matrix: + python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] + # python-version: [3.13, 3.12] # ["3.10", "3.11", "3.12", "3.13"] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | @@ -42,4 +44,3 @@ jobs: # file: ./coverage.xml # flags: unittests # name: codecov-umbrella - diff --git a/pyproject.toml b/pyproject.toml index cc49a543..da694837 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ authors = [ description = "A package for multidisciplinary and/or multifidelity wind farm design" readme= "README.md" requires-python = ">=3.10, <3.13" +# requires-python = ">=3.10, <3.14" classifiers = [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: Apache Software License", From 712563b9a0581029f2e06a39b6f6508d585c0a4b Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Mon, 23 Jun 2025 13:20:54 -0600 Subject: [PATCH 2/7] remove comments --- .github/workflows/python-tests-system.yml | 1 - .github/workflows/python-tests-unit.yml | 1 - pyproject.toml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/python-tests-system.yml b/.github/workflows/python-tests-system.yml index be9fcba9..754307cb 100644 --- a/.github/workflows/python-tests-system.yml +++ b/.github/workflows/python-tests-system.yml @@ -13,7 +13,6 @@ jobs: strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - # python-version: [3.13, 3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/python-tests-unit.yml b/.github/workflows/python-tests-unit.yml index 9ebef09a..c16f4131 100644 --- a/.github/workflows/python-tests-unit.yml +++ b/.github/workflows/python-tests-unit.yml @@ -13,7 +13,6 @@ jobs: strategy: matrix: python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"] - # python-version: [3.13, 3.12] # ["3.10", "3.11", "3.12", "3.13"] os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/pyproject.toml b/pyproject.toml index 423abd02..52e09f4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ authors = [ description = "A package for multidisciplinary and/or multifidelity wind farm design" readme= "README.md" requires-python = ">=3.10, <3.13" -# requires-python = ">=3.10, <3.14" classifiers = [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: Apache Software License", From 9c121952472771085eb5453562085cfe0bb4da3a Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Wed, 2 Jul 2025 08:36:11 -0600 Subject: [PATCH 3/7] update pyrite values --- pyproject.toml | 2 +- .../LCOE_stack/test_LCOE_LB_stack_pyrite.npz | Bin 1300 -> 1300 bytes .../LCOE_stack/test_LCOE_OFB_stack_pyrite.npz | Bin 1300 -> 1300 bytes .../LCOE_stack/test_LCOE_OFL_stack_pyrite.npz | Bin 1300 -> 1300 bytes .../test_landbosse_wrap_baseline_farm.npz | Bin 548 -> 548 bytes .../cost/test_orbit_wrap_baseline_farm.npz | Bin 542 -> 542 bytes 6 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3a9de612..c129c361 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ dependencies = [ "numpy<2.3", "floris>=4.3", - "wisdem==3.18.1", + "wisdem", "NLopt", "marmot-agents", "openmdao", diff --git a/test/system/ard/LCOE_stack/test_LCOE_LB_stack_pyrite.npz b/test/system/ard/LCOE_stack/test_LCOE_LB_stack_pyrite.npz index f46f2df67fda89d4e8cda05a5c5f7d9836bbd839..66549725658f545b644fbb8907d4077d64b6ac29 100644 GIT binary patch delta 120 zcmbQjHHAwkz?+#xmjMD48Txnc+%!>WHKWtSeRo)j9anFiJdbfTyMtO=qT6kk$pK7P zS=hyo6-?G-UL#XI)8V3$h?_%zHzSiSGpZ4jKQb3Uw0~q4n_SHj3DGu>MQrjr7Bv8# C0wxXs delta 120 zcmbQjHHAwkz?+#xmjMD489wcq^I@XUYDR~N`|hypt~l~%@;t`X>|Y{sG^H1~P7YwY z%JNb5TJ2;_<~1_jhb}7=+q*dgcr!BTGNT$X`6F`yMEgf(vB}jekq~Y3Si~m3V^ISD Dx|1t} diff --git a/test/system/ard/LCOE_stack/test_LCOE_OFB_stack_pyrite.npz b/test/system/ard/LCOE_stack/test_LCOE_OFB_stack_pyrite.npz index f7601a51b1f8815be8f893f133c80b8e6b2c2fd9..abbe598db702fc9c3dd6f681a4eea9b9eaf9d225 100644 GIT binary patch delta 41 tcmbQjHHB+~Dl<#%{LPY+HJR72C&#D-T69HEzQg}{}As0 diff --git a/test/system/ard/LCOE_stack/test_LCOE_OFL_stack_pyrite.npz b/test/system/ard/LCOE_stack/test_LCOE_OFL_stack_pyrite.npz index 06b8fb568ffbc56b98af7a7366ee1d3ab1daa06c..fc994b739056348665f07577aad4f0045b1f3278 100644 GIT binary patch delta 41 ucmbQjHHB+~Dl^N=7yIr_)?{A8z9Id;g|TP!IG{?t%u;ZicxSz|gIZgn+ie%1 XEF+UHGm7TP%NVU$K delta 96 zcmZ3&vV=u2z?+#xmjMD48S-RxCJJtpN@EXMd2VZ^1FEEAus_GdJL{#tMC52nFK`9Q WGBW8hqiCMIjM16}q;B$4MtcCTf6BT+e>!UT^Q0{}U$nGx~tVCf{eY2LL<75o!Pc delta 35 ocmbQoGLL1#RTlkfgOG_g*Rv-*I`efG Date: Wed, 2 Jul 2025 09:34:13 -0600 Subject: [PATCH 4/7] fixes to 3.21 rather than 3.20 --- README.md | 2 +- ard/cost/wisdem_wrap.py | 2 +- pyproject.toml | 2 +- .../LCOE_stack/test_LCOE_OFB_stack_pyrite.npz | Bin 1300 -> 1300 bytes .../LCOE_stack/test_LCOE_OFL_stack_pyrite.npz | Bin 1300 -> 1300 bytes .../cost/test_orbit_wrap_baseline_farm.npz | Bin 542 -> 542 bytes 6 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4180e26b..a107f72d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ There can be some hardware-software mis-specification issues with WISDEM install In the event of issues, WISDEM can be installed manually or using `conda` without issues, then `pip` installation can proceed. ```shell -mamba install wisdem=3.18.1 -y +mamba install wisdem -y pip install -e .[dev,docs] ``` diff --git a/ard/cost/wisdem_wrap.py b/ard/cost/wisdem_wrap.py index a4f71394..5a12d9ab 100644 --- a/ard/cost/wisdem_wrap.py +++ b/ard/cost/wisdem_wrap.py @@ -4,7 +4,7 @@ import openmdao.api as om from wisdem.plant_financese.plant_finance import PlantFinance as PlantFinance_orig from wisdem.landbosse.landbosse_omdao.landbosse import LandBOSSE as LandBOSSE_orig -from wisdem.orbit.api.wisdem import Orbit as Orbit_orig +from wisdem.orbit.orbit_api import Orbit as Orbit_orig from ard.cost.approximate_turbine_spacing import SpacingApproximations diff --git a/pyproject.toml b/pyproject.toml index c129c361..7ff926a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ dependencies = [ "numpy<2.3", "floris>=4.3", - "wisdem", + "wisdem>=3.21", "NLopt", "marmot-agents", "openmdao", diff --git a/test/system/ard/LCOE_stack/test_LCOE_OFB_stack_pyrite.npz b/test/system/ard/LCOE_stack/test_LCOE_OFB_stack_pyrite.npz index abbe598db702fc9c3dd6f681a4eea9b9eaf9d225..06939d90cf1a5cf3176d1ac87298bcb13cecc824 100644 GIT binary patch delta 75 zcmbQjHHB-#EJl{QH&<_&JdbfT`|WxW^BQ&?t$XV_RAMLJ ZVQz(}{Kzaextb*sqGBG4*yMLCY5)UVA&&q6 delta 75 zcmbQjHHB-#EJl`ZA~QTE&tqK8US#LurxzSPIe_UZOYQv4l9M%=*RUtYs0CVdMNhuN Y+zL_oky&hVHA^H!#XJ_V$?sUy02Fo`umAu6 diff --git a/test/system/ard/LCOE_stack/test_LCOE_OFL_stack_pyrite.npz b/test/system/ard/LCOE_stack/test_LCOE_OFL_stack_pyrite.npz index fc994b739056348665f07577aad4f0045b1f3278..73d6702d1e0e02ade3278b0146b02ec55ae7c73a 100644 GIT binary patch delta 75 zcmbQjHHB-#EJhZebu(Qj&tqK8{^jJVKGWjS!yCvUPQ^BVSVJG2{%?#4{M Z!`uo{`H@*{ay3gNM8!N7vB~dP)Bx(KAd~HjT^J)*eAqW5f diff --git a/test/unit/ard/cost/test_orbit_wrap_baseline_farm.npz b/test/unit/ard/cost/test_orbit_wrap_baseline_farm.npz index 1083afa226eb9e1f15c609ce5d16409e97596f44..40953abf6d3f3f48944717155fa5113740432d49 100644 GIT binary patch delta 98 zcmbQoGLJYluW(VPXOaPoaddjKo_9YX*B From 3e2296095e7d46d9114605cbbdf4651b598f8049 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Wed, 2 Jul 2025 10:10:11 -0600 Subject: [PATCH 5/7] update test utils for clarity --- ard/utils/test_utils.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ard/utils/test_utils.py b/ard/utils/test_utils.py index e26bbf1a..1c320fce 100644 --- a/ard/utils/test_utils.py +++ b/ard/utils/test_utils.py @@ -1,8 +1,9 @@ -from fileinput import filename +import sys from os import PathLike from pathlib import Path import numpy as np +import traceback def pyrite_validator( @@ -31,6 +32,7 @@ def pyrite_validator( pyrite_data = np.load(filename_pyrite.with_suffix(".npz")) # for each of the variables in the pyrite-standard data file + all_validation_matches = True for k, v in pyrite_data.items(): # count how many of the values in the data match the equivalent validation data sum_isclose = np.sum( @@ -41,11 +43,17 @@ def pyrite_validator( validation_matches = sum_isclose == vd_size if not validation_matches: - print(f"for variable {k}:") + print(f"for variable {k}:", file=sys.stderr) print( - f"\t{sum_isclose} values match of {vd_size} total validation values" + f"\t{sum_isclose} values match of {vd_size} total validation values", + file=sys.stderr, ) - print(f"\tto a tolerance of {rtol_val:e}") - print(f"saved data for {k}: {v}") - print(f"computed data for {k}: {validation_data[k]}") - assert validation_matches + print(f"\tto a tolerance of {rtol_val:e}", file=sys.stderr) + print(f"saved data for {k}: {v}", file=sys.stderr) + print(f"computed data for {k}: {validation_data[k]}", file=sys.stderr) + stack = traceback.format_stack(limit=3) + print("".join(stack[-2]).replace(" File", "test:"), file=sys.stderr) + print(file=sys.stderr) + + all_validation_matches &= validation_matches + assert all_validation_matches, "Pyrite validation data must match." From b0bb9c94645884b2ecfc61ea04a3c453e6740d8d Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Wed, 2 Jul 2025 10:50:47 -0600 Subject: [PATCH 6/7] a little more improvement to the test utils --- ard/utils/test_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ard/utils/test_utils.py b/ard/utils/test_utils.py index 1c320fce..75a7ca75 100644 --- a/ard/utils/test_utils.py +++ b/ard/utils/test_utils.py @@ -7,7 +7,7 @@ def pyrite_validator( - validation_data: dict, + data_for_validation: dict, filename_pyrite: PathLike, rewrite: bool = False, rtol_val: float = 1e-6, @@ -23,7 +23,7 @@ def pyrite_validator( # this helper function can write a file to hold pyrite-standard data # write out a npz file that holds the variables we want to be able to check - np.savez(filename_pyrite, **validation_data) + np.savez(filename_pyrite, **data_for_validation) assert False else: # ... or it can check to make sure that an existing pyrite file matches the current data @@ -36,9 +36,9 @@ def pyrite_validator( for k, v in pyrite_data.items(): # count how many of the values in the data match the equivalent validation data sum_isclose = np.sum( - np.isclose(np.array(v), validation_data[k], rtol=rtol_val) + np.isclose(np.array(v), data_for_validation[k], rtol=rtol_val) ) - vd_size = np.array(validation_data[k], dtype=np.float64).size + vd_size = np.array(data_for_validation[k], dtype=np.float64).size # assert all of the values match validation_matches = sum_isclose == vd_size @@ -49,8 +49,8 @@ def pyrite_validator( file=sys.stderr, ) print(f"\tto a tolerance of {rtol_val:e}", file=sys.stderr) - print(f"saved data for {k}: {v}", file=sys.stderr) - print(f"computed data for {k}: {validation_data[k]}", 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) stack = traceback.format_stack(limit=3) print("".join(stack[-2]).replace(" File", "test:"), file=sys.stderr) print(file=sys.stderr) From dfec26ac93c830df838c86340dce71d10a5b90c2 Mon Sep 17 00:00:00 2001 From: Cory Frontin Date: Wed, 2 Jul 2025 11:00:54 -0600 Subject: [PATCH 7/7] black reformat... --- ard/utils/test_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ard/utils/test_utils.py b/ard/utils/test_utils.py index 75a7ca75..831cbc16 100644 --- a/ard/utils/test_utils.py +++ b/ard/utils/test_utils.py @@ -50,7 +50,9 @@ def pyrite_validator( ) print(f"\tto 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) + print( + f"computed data for {k}: {data_for_validation[k]}", file=sys.stderr + ) stack = traceback.format_stack(limit=3) print("".join(stack[-2]).replace(" File", "test:"), file=sys.stderr) print(file=sys.stderr)