From cd052d441285c1ea4fa9a178e07ed17ca4765018 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 11:49:00 -0700 Subject: [PATCH 01/12] Can we support Python 3.12? --- .github/workflows/black.yaml | 18 ----------- .github/workflows/coverage.yaml | 41 ------------------------- .github/workflows/docs.yaml | 41 ------------------------- .github/workflows/licensechecker.yaml | 9 ------ .github/workflows/linting.yaml | 21 ------------- .github/workflows/mac_tests.yaml | 28 ----------------- .github/workflows/unittests.yaml | 2 +- .github/workflows/validatemanifest.yaml | 19 ------------ .github/workflows/wintests.yaml | 30 ------------------ 9 files changed, 1 insertion(+), 208 deletions(-) delete mode 100644 .github/workflows/black.yaml delete mode 100644 .github/workflows/coverage.yaml delete mode 100644 .github/workflows/docs.yaml delete mode 100644 .github/workflows/licensechecker.yaml delete mode 100644 .github/workflows/linting.yaml delete mode 100644 .github/workflows/mac_tests.yaml delete mode 100644 .github/workflows/validatemanifest.yaml delete mode 100644 .github/workflows/wintests.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml deleted file mode 100644 index bc42c84ad..000000000 --- a/.github/workflows/black.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: black - -on: [push, pull_request] - -# use workaround due to: https://github.com/psf/black/issues/2079#issuecomment-812359146 -jobs: - check-formatting: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.11 - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Install Black - run: pip install 'black==22.6.0' - - name: Run black --check . - run: black --check . diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index 006512ded..000000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Coverage - -on: - push: - branches: - - main - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - runs-on: ubuntu-24.04 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Update package index - run: sudo apt-get update - - name: Install ARMI and MPI - run: | - sudo apt-get -y install libopenmpi-dev - pip install -e .[memprof,mpi,test] - - name: Run Coverage - run: | - coverage run --rcfile=pyproject.toml -m pytest -n 4 --cov=armi --cov-config=pyproject.toml --cov-report=lcov --ignore=venv armi - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true - coverage combine --rcfile=pyproject.toml --keep -a - - name: Publish to coveralls.io - uses: coverallsapp/github-action@v1.1.2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: coverage.lcov diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml deleted file mode 100644 index 8f7f1a0cf..000000000 --- a/.github/workflows/docs.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Documentation - -on: - push: - branches: - - main - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Update package index - run: sudo apt-get update - - name: Install mpi libs - run: sudo apt-get -y install libopenmpi-dev - - name: Install Pandoc - run: sudo apt-get -y install pandoc - - name: Setup Graphviz - uses: ts-graphviz/setup-graphviz@v2.0.2 - - name: Make HTML Docs - run: | - pip install -e .[memprof,mpi,test,docs] - cd doc - git submodule init - git submodule update - make html - - name: deploy - uses: JamesIves/github-pages-deploy-action@v4.6.1 - with: - token: ${{ secrets.ACCESS_TOKEN }} - repository-name: ${{ github.repository_owner }}/terrapower.github.io - branch: main - folder: doc/_build/html - target-folder: armi diff --git a/.github/workflows/licensechecker.yaml b/.github/workflows/licensechecker.yaml deleted file mode 100644 index abeee0e47..000000000 --- a/.github/workflows/licensechecker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: Check License Lines -on: [push, pull_request] -jobs: - check-license-lines: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@master - - name: Check License Lines - uses: kt3k/license_checker@v1.0.6 diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml deleted file mode 100644 index 89fca391d..000000000 --- a/.github/workflows/linting.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Linting - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Update package index - run: sudo apt-get update - - name: Run Linter - run: | - pip install -e .[test] - ruff check . diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml deleted file mode 100644 index 3cb782082..000000000 --- a/.github/workflows/mac_tests.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: ARMI MacOS Tests - -on: - push: - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - - runs-on: macos-14 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Upgrade PIP - run: python -m pip install --upgrade pip - - name: Run Unit Tests on MacOS - run: | - brew install openmpi - pip install -e .[memprof,mpi,test] - pytest -n 4 armi diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index b020e6dbf..78d1305df 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - python: [3.9, '3.10', '3.11'] + python: [3.9, '3.12'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/validatemanifest.yaml b/.github/workflows/validatemanifest.yaml deleted file mode 100644 index acd640208..000000000 --- a/.github/workflows/validatemanifest.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Validate Manifest - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Validate Manifest - run: | - pip install toml - python .github/workflows/validatemanifest.py diff --git a/.github/workflows/wintests.yaml b/.github/workflows/wintests.yaml deleted file mode 100644 index e141cb14a..000000000 --- a/.github/workflows/wintests.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: ARMI Windows tests - -on: - push: - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - - runs-on: windows-2022 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Upgrade PIP - run: python -m pip install --upgrade pip - - name: Run Unit Tests on Windows - run: | - pip install mpi4py==3.1.6 - pip install -e .[memprof,mpi,test] - pytest -n 4 armi - - name: Find Test Crumbs - run: python .github/workflows/find_test_crumbs.py From a6a34aa455f4fb3ffde9bd19924d92feca10fdb2 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 11:54:24 -0700 Subject: [PATCH 02/12] ruamel troubles --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 19ae48a2b..dad8dff93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,8 @@ dependencies = [ "pluggy>=1.2.0", # Central tool behind the ARMI Plugin system "pyDOE>=0.3.8", # We import a Latin-hypercube algorithm to explore a phase space "pyevtk>=1.2.0", # Handles binary VTK visualization files - "ruamel.yaml.clib<=0.2.7", # C-based core of ruamel below - "ruamel.yaml<=0.17.21", # Our foundational YAML library + "ruamel.yaml.clib", # C-based core of ruamel below + "ruamel.yaml", # Our foundational YAML library "scipy>=1.7.0", # Used for curve-fitting and matrix math "tabulate>=0.8.9", # Used to pretty-print tabular data "toml>0.9.5", # Needed to parse the pyproject.toml file From 5b88c468df1622c312c9dd8114320987f0846bd3 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 11:59:00 -0700 Subject: [PATCH 03/12] Trying to support Python 3.12 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dad8dff93..69cf588c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ authors = [ ] dependencies = [ "coverage>=7.2.0", # Code coverage tool. Sadly baked into every Case. - "h5py>=3.0,<=3.9", # Needed because our database files are H5 format + "h5py>=3.9", # Needed because our database files are H5 format "htmltree>=0.7.6", # Our reports have HTML output "matplotlib>=3.5.3,<3.8.0", # Important plotting library "numpy>=1.21", # Important math library From 8d3d192752df0507d25bbbf155b487a9e1de55ae Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 13:14:15 -0700 Subject: [PATCH 04/12] Trying to get 3.12 working --- .github/workflows/unittests.yaml | 2 +- armi/reactor/assemblies.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index 78d1305df..da0381ceb 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - python: [3.9, '3.12'] + python: ['3.12'] steps: - uses: actions/checkout@v2 diff --git a/armi/reactor/assemblies.py b/armi/reactor/assemblies.py index bfe4ea8e3..03364d491 100644 --- a/armi/reactor/assemblies.py +++ b/armi/reactor/assemblies.py @@ -66,7 +66,7 @@ def __init__(self, typ, assemNum=None): """ # If no assembly number is provided, generate a random number as a placeholder. if assemNum is None: - assemNum = randint(-9e12, -1) + assemNum = randint(-9000000000000, -1) name = self.makeNameFromAssemNum(assemNum) composites.Composite.__init__(self, name) self.p.assemNum = assemNum @@ -157,7 +157,7 @@ def makeUnique(self): otherwise have been the same object. """ # Default to a random negative assembly number (unique enough) - self.p.assemNum = randint(-9e12, -1) + self.p.assemNum = randint(-9000000000000, -1) self.renumber(self.p.assemNum) def add(self, obj: blocks.Block): From 848ad9e60a29457129c1627c72ed15a0fdf36374 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 13:32:41 -0700 Subject: [PATCH 05/12] unittest std lib change --- armi/cases/tests/test_suiteBuilder.py | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/armi/cases/tests/test_suiteBuilder.py b/armi/cases/tests/test_suiteBuilder.py index e1681091f..4f1c5780e 100644 --- a/armi/cases/tests/test_suiteBuilder.py +++ b/armi/cases/tests/test_suiteBuilder.py @@ -116,25 +116,25 @@ def test_buildSuite(self): SettingModifier("settingName2", value) for value in (3, 4, 5) ) - self.assertEquals(builder.modifierSets[0][0].value, 1) - self.assertEquals(builder.modifierSets[0][1].value, 3) + self.assertEqual(builder.modifierSets[0][0].value, 1) + self.assertEqual(builder.modifierSets[0][1].value, 3) - self.assertEquals(builder.modifierSets[1][0].value, 2) - self.assertEquals(builder.modifierSets[1][1].value, 3) + self.assertEqual(builder.modifierSets[1][0].value, 2) + self.assertEqual(builder.modifierSets[1][1].value, 3) - self.assertEquals(builder.modifierSets[2][0].value, 1) - self.assertEquals(builder.modifierSets[2][1].value, 4) + self.assertEqual(builder.modifierSets[2][0].value, 1) + self.assertEqual(builder.modifierSets[2][1].value, 4) - self.assertEquals(builder.modifierSets[3][0].value, 2) - self.assertEquals(builder.modifierSets[3][1].value, 4) + self.assertEqual(builder.modifierSets[3][0].value, 2) + self.assertEqual(builder.modifierSets[3][1].value, 4) - self.assertEquals(builder.modifierSets[4][0].value, 1) - self.assertEquals(builder.modifierSets[4][1].value, 5) + self.assertEqual(builder.modifierSets[4][0].value, 1) + self.assertEqual(builder.modifierSets[4][1].value, 5) - self.assertEquals(builder.modifierSets[5][0].value, 2) - self.assertEquals(builder.modifierSets[5][1].value, 5) + self.assertEqual(builder.modifierSets[5][0].value, 2) + self.assertEqual(builder.modifierSets[5][1].value, 5) - self.assertEquals(len(builder.modifierSets), 6) + self.assertEqual(len(builder.modifierSets), 6) class TestSeparateEffectsBuilder(unittest.TestCase): @@ -155,19 +155,19 @@ def test_buildSuite(self): SettingModifier("settingName2", value) for value in (3, 4, 5) ) - self.assertEquals(builder.modifierSets[0][0].value, 1) - self.assertEquals(builder.modifierSets[0][0].settingName, "settingName1") + self.assertEqual(builder.modifierSets[0][0].value, 1) + self.assertEqual(builder.modifierSets[0][0].settingName, "settingName1") - self.assertEquals(builder.modifierSets[1][0].value, 2) - self.assertEquals(builder.modifierSets[1][0].settingName, "settingName1") + self.assertEqual(builder.modifierSets[1][0].value, 2) + self.assertEqual(builder.modifierSets[1][0].settingName, "settingName1") - self.assertEquals(builder.modifierSets[2][0].value, 3) - self.assertEquals(builder.modifierSets[2][0].settingName, "settingName2") + self.assertEqual(builder.modifierSets[2][0].value, 3) + self.assertEqual(builder.modifierSets[2][0].settingName, "settingName2") - self.assertEquals(builder.modifierSets[3][0].value, 4) - self.assertEquals(builder.modifierSets[3][0].settingName, "settingName2") + self.assertEqual(builder.modifierSets[3][0].value, 4) + self.assertEqual(builder.modifierSets[3][0].settingName, "settingName2") - self.assertEquals(builder.modifierSets[4][0].value, 5) - self.assertEquals(builder.modifierSets[4][0].settingName, "settingName2") + self.assertEqual(builder.modifierSets[4][0].value, 5) + self.assertEqual(builder.modifierSets[4][0].settingName, "settingName2") - self.assertEquals(len(builder.modifierSets), 5) + self.assertEqual(len(builder.modifierSets), 5) From 2546a3140f2ba01f165e8bdfe02eb625b4477276 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 14:07:42 -0700 Subject: [PATCH 06/12] Fixing a test --- armi/nucDirectory/tests/test_nuclideBases.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/armi/nucDirectory/tests/test_nuclideBases.py b/armi/nucDirectory/tests/test_nuclideBases.py index 1de82a039..9d4831646 100644 --- a/armi/nucDirectory/tests/test_nuclideBases.py +++ b/armi/nucDirectory/tests/test_nuclideBases.py @@ -127,12 +127,13 @@ def test_NaturalNuclide_atomicWeightIsAverageOfNaturallyOccuringIsotopes(self): atomicMass = 0.0 for natIso in natNuk.getNaturalIsotopics(): atomicMass += natIso.abundance * natIso.weight - self.assertEqual( + self.assertAlmostEqual( atomicMass, natNuk.weight, "{} weight is {}, expected {}".format( natNuk, natNuk.weight, atomicMass ), + delta=0.000001, ) def test_nucBases_labelAndNameCollsionsAreForSameNuclide(self): From 7f7b187cba20f852a2bbb51cc7aa7cee2422e4f6 Mon Sep 17 00:00:00 2001 From: jstilley Date: Wed, 31 Jul 2024 14:26:14 -0700 Subject: [PATCH 07/12] Fixing test --- armi/nucDirectory/tests/test_nuclideBases.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/armi/nucDirectory/tests/test_nuclideBases.py b/armi/nucDirectory/tests/test_nuclideBases.py index 9d4831646..01ca11f08 100644 --- a/armi/nucDirectory/tests/test_nuclideBases.py +++ b/armi/nucDirectory/tests/test_nuclideBases.py @@ -127,14 +127,7 @@ def test_NaturalNuclide_atomicWeightIsAverageOfNaturallyOccuringIsotopes(self): atomicMass = 0.0 for natIso in natNuk.getNaturalIsotopics(): atomicMass += natIso.abundance * natIso.weight - self.assertAlmostEqual( - atomicMass, - natNuk.weight, - "{} weight is {}, expected {}".format( - natNuk, natNuk.weight, atomicMass - ), - delta=0.000001, - ) + self.assertAlmostEqual(atomicMass, natNuk.weight, delta=0.000001) def test_nucBases_labelAndNameCollsionsAreForSameNuclide(self): """The name and labels for correct for nuclides. From 4674780f6ceec46dcf982feab6110f833a93bfc7 Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 8 Aug 2024 12:23:22 -0700 Subject: [PATCH 08/12] Trying to fix unit tests --- armi/bookkeeping/db/tests/test_database3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/bookkeeping/db/tests/test_database3.py b/armi/bookkeeping/db/tests/test_database3.py index 18b8921b9..da46f2237 100644 --- a/armi/bookkeeping/db/tests/test_database3.py +++ b/armi/bookkeeping/db/tests/test_database3.py @@ -354,7 +354,7 @@ def test_mergeHistory(self): tnGroup["layout/serialNum"], tnGroup, { - "fakeBigData": numpy.eye(6400), + "fakeBigData": numpy.eye(640), "someString": "this isn't a reference to another dataset", }, ) @@ -377,7 +377,7 @@ def test_mergeHistory(self): attrs = database3.Database3._resolveAttrs( tnGroup["layout/serialNum"].attrs, tnGroup ) - self.assertTrue(numpy.array_equal(attrs["fakeBigData"], numpy.eye(6400))) + self.assertTrue(numpy.array_equal(attrs["fakeBigData"], numpy.eye(640))) keys = sorted(db2.keys()) self.assertEqual(len(keys), 4) From ad9638ea67ac228559868852319d8e38e26eeaa7 Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 8 Aug 2024 12:45:44 -0700 Subject: [PATCH 09/12] Try this! --- armi/bookkeeping/db/layout.py | 57 ++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/armi/bookkeeping/db/layout.py b/armi/bookkeeping/db/layout.py index b0b329710..e09acab52 100644 --- a/armi/bookkeeping/db/layout.py +++ b/armi/bookkeeping/db/layout.py @@ -405,36 +405,55 @@ def writeToDB(self, h5group): "layout/type", data=numpy.array(self.type).astype("S"), compression="gzip", + track_order=True, ) h5group.create_dataset( "layout/name", data=numpy.array(self.name).astype("S"), compression="gzip", + track_order=True, ) h5group.create_dataset( - "layout/serialNum", data=self.serialNum, compression="gzip" + "layout/serialNum", + data=self.serialNum, + compression="gzip", + track_order=True, ) h5group.create_dataset( - "layout/indexInData", data=self.indexInData, compression="gzip" + "layout/indexInData", + data=self.indexInData, + compression="gzip", + track_order=True, ) h5group.create_dataset( - "layout/numChildren", data=self.numChildren, compression="gzip" + "layout/numChildren", + data=self.numChildren, + compression="gzip", + track_order=True, ) h5group.create_dataset( - "layout/location", data=self.location, compression="gzip" + "layout/location", + data=self.location, + compression="gzip", + track_order=True, ) h5group.create_dataset( "layout/locationType", data=numpy.array(self.locationType).astype("S"), compression="gzip", + track_order=True, ) h5group.create_dataset( "layout/material", data=numpy.array(self.material).astype("S"), compression="gzip", + track_order=True, ) h5group.create_dataset( - "layout/temperatures", data=self.temperatures, compression="gzip" + "layout/temperatures", + data=self.temperatures, + compression="gzip", + track_order=True, ) h5group.create_dataset( @@ -445,31 +464,41 @@ def writeToDB(self, h5group): compression="gzip", ) - gridsGroup = h5group.create_group("layout/grids") + gridsGroup = h5group.create_group("layout/grids", track_order=True) gridsGroup.attrs["nGrids"] = len(self.gridParams) gridsGroup.create_dataset( - "type", data=numpy.array([gp[0] for gp in self.gridParams]).astype("S") + "type", + data=numpy.array([gp[0] for gp in self.gridParams]).astype("S"), + track_order=True, ) for igrid, gridParams in enumerate(gp[1] for gp in self.gridParams): - thisGroup = gridsGroup.create_group(str(igrid)) - thisGroup.create_dataset("unitSteps", data=gridParams.unitSteps) + thisGroup = gridsGroup.create_group(str(igrid), track_order=True) + thisGroup.create_dataset( + "unitSteps", data=gridParams.unitSteps, track_order=True + ) for ibound, bound in enumerate(gridParams.bounds): if bound is not None: bound = numpy.array(bound) - thisGroup.create_dataset("bounds_{}".format(ibound), data=bound) + thisGroup.create_dataset( + "bounds_{}".format(ibound), data=bound, track_order=True + ) thisGroup.create_dataset( - "unitStepLimits", data=gridParams.unitStepLimits + "unitStepLimits", data=gridParams.unitStepLimits, track_order=True ) offset = gridParams.offset thisGroup.attrs["offset"] = offset is not None if offset is not None: - thisGroup.create_dataset("offset", data=offset) - thisGroup.create_dataset("geomType", data=gridParams.geomType) - thisGroup.create_dataset("symmetry", data=gridParams.symmetry) + thisGroup.create_dataset("offset", data=offset, track_order=True) + thisGroup.create_dataset( + "geomType", data=gridParams.geomType, track_order=True + ) + thisGroup.create_dataset( + "symmetry", data=gridParams.symmetry, track_order=True + ) except RuntimeError: runLog.error("Failed to create datasets in: {}".format(h5group)) raise From b4a4ea5ae49fa395ae686e3c1a423efd09b96b97 Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 8 Aug 2024 14:21:31 -0700 Subject: [PATCH 10/12] Trying to fix H5PY --- armi/bookkeeping/db/database3.py | 2 +- armi/bookkeeping/db/layout.py | 12 ++---------- armi/bookkeeping/db/tests/test_database3.py | 11 ++++++----- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/armi/bookkeeping/db/database3.py b/armi/bookkeeping/db/database3.py index 99e3efddb..f1f35d572 100644 --- a/armi/bookkeeping/db/database3.py +++ b/armi/bookkeeping/db/database3.py @@ -1462,7 +1462,7 @@ def _writeAttrs(obj, group, attrs): ) if "attrs" not in group: - attrGroup = group.create_group("attrs", track_order=True) + attrGroup = group.create_group("attrs") else: attrGroup = group["attrs"] dataName = str(len(attrGroup)) + "_" + key diff --git a/armi/bookkeeping/db/layout.py b/armi/bookkeeping/db/layout.py index e09acab52..a2b38f720 100644 --- a/armi/bookkeeping/db/layout.py +++ b/armi/bookkeeping/db/layout.py @@ -405,25 +405,17 @@ def writeToDB(self, h5group): "layout/type", data=numpy.array(self.type).astype("S"), compression="gzip", - track_order=True, ) h5group.create_dataset( "layout/name", data=numpy.array(self.name).astype("S"), compression="gzip", - track_order=True, ) h5group.create_dataset( - "layout/serialNum", - data=self.serialNum, - compression="gzip", - track_order=True, + "layout/serialNum", data=self.serialNum, compression="gzip" ) h5group.create_dataset( - "layout/indexInData", - data=self.indexInData, - compression="gzip", - track_order=True, + "layout/indexInData", data=self.indexInData, compression="gzip" ) h5group.create_dataset( "layout/numChildren", diff --git a/armi/bookkeeping/db/tests/test_database3.py b/armi/bookkeeping/db/tests/test_database3.py index da46f2237..a77629830 100644 --- a/armi/bookkeeping/db/tests/test_database3.py +++ b/armi/bookkeeping/db/tests/test_database3.py @@ -350,12 +350,13 @@ def test_mergeHistory(self): self.r.p.cycle = 1 self.r.p.timeNode = 0 tnGroup = self.db.getH5Group(self.r) + randomText = "this isn't a reference to another dataset" database3.Database3._writeAttrs( tnGroup["layout/serialNum"], tnGroup, { - "fakeBigData": numpy.eye(640), - "someString": "this isn't a reference to another dataset", + "fakeBigData": numpy.eye(64), + "someString": randomText, }, ) @@ -369,15 +370,15 @@ def test_mergeHistory(self): # this test is a little bit implementation-specific, but nice to be explicit self.assertEqual( - tnGroup["layout/serialNum"].attrs["fakeBigData"], - "@/c01n00/attrs/0_fakeBigData", + tnGroup["layout/serialNum"].attrs["someString"], + randomText, ) # exercise the _resolveAttrs function attrs = database3.Database3._resolveAttrs( tnGroup["layout/serialNum"].attrs, tnGroup ) - self.assertTrue(numpy.array_equal(attrs["fakeBigData"], numpy.eye(640))) + self.assertTrue(numpy.array_equal(attrs["fakeBigData"], numpy.eye(64))) keys = sorted(db2.keys()) self.assertEqual(len(keys), 4) From 408dadb1769fe71d2ada91b688f74ca26d92f07d Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 8 Aug 2024 15:18:42 -0700 Subject: [PATCH 11/12] Reinstating the rest of normal CI --- .github/workflows/black.yaml | 18 +++++++++++ .github/workflows/coverage.yaml | 41 +++++++++++++++++++++++++ .github/workflows/docs.yaml | 41 +++++++++++++++++++++++++ .github/workflows/licensechecker.yaml | 9 ++++++ .github/workflows/linting.yaml | 21 +++++++++++++ .github/workflows/mac_tests.yaml | 28 +++++++++++++++++ .github/workflows/unittests.yaml | 2 +- .github/workflows/validatemanifest.yaml | 19 ++++++++++++ .github/workflows/wintests.yaml | 30 ++++++++++++++++++ pyproject.toml | 10 ++++-- 10 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/black.yaml create mode 100644 .github/workflows/coverage.yaml create mode 100644 .github/workflows/docs.yaml create mode 100644 .github/workflows/licensechecker.yaml create mode 100644 .github/workflows/linting.yaml create mode 100644 .github/workflows/mac_tests.yaml create mode 100644 .github/workflows/validatemanifest.yaml create mode 100644 .github/workflows/wintests.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 000000000..bc42c84ad --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,18 @@ +name: black + +on: [push, pull_request] + +# use workaround due to: https://github.com/psf/black/issues/2079#issuecomment-812359146 +jobs: + check-formatting: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Install Black + run: pip install 'black==22.6.0' + - name: Run black --check . + run: black --check . diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 000000000..006512ded --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,41 @@ +name: Coverage + +on: + push: + branches: + - main + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + runs-on: ubuntu-24.04 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Update package index + run: sudo apt-get update + - name: Install ARMI and MPI + run: | + sudo apt-get -y install libopenmpi-dev + pip install -e .[memprof,mpi,test] + - name: Run Coverage + run: | + coverage run --rcfile=pyproject.toml -m pytest -n 4 --cov=armi --cov-config=pyproject.toml --cov-report=lcov --ignore=venv armi + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true + coverage combine --rcfile=pyproject.toml --keep -a + - name: Publish to coveralls.io + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage.lcov diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..8f7f1a0cf --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,41 @@ +name: Documentation + +on: + push: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Update package index + run: sudo apt-get update + - name: Install mpi libs + run: sudo apt-get -y install libopenmpi-dev + - name: Install Pandoc + run: sudo apt-get -y install pandoc + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v2.0.2 + - name: Make HTML Docs + run: | + pip install -e .[memprof,mpi,test,docs] + cd doc + git submodule init + git submodule update + make html + - name: deploy + uses: JamesIves/github-pages-deploy-action@v4.6.1 + with: + token: ${{ secrets.ACCESS_TOKEN }} + repository-name: ${{ github.repository_owner }}/terrapower.github.io + branch: main + folder: doc/_build/html + target-folder: armi diff --git a/.github/workflows/licensechecker.yaml b/.github/workflows/licensechecker.yaml new file mode 100644 index 000000000..abeee0e47 --- /dev/null +++ b/.github/workflows/licensechecker.yaml @@ -0,0 +1,9 @@ +name: Check License Lines +on: [push, pull_request] +jobs: + check-license-lines: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@master + - name: Check License Lines + uses: kt3k/license_checker@v1.0.6 diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml new file mode 100644 index 000000000..89fca391d --- /dev/null +++ b/.github/workflows/linting.yaml @@ -0,0 +1,21 @@ +name: Linting + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Update package index + run: sudo apt-get update + - name: Run Linter + run: | + pip install -e .[test] + ruff check . diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml new file mode 100644 index 000000000..3cb782082 --- /dev/null +++ b/.github/workflows/mac_tests.yaml @@ -0,0 +1,28 @@ +name: ARMI MacOS Tests + +on: + push: + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + + runs-on: macos-14 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Upgrade PIP + run: python -m pip install --upgrade pip + - name: Run Unit Tests on MacOS + run: | + brew install openmpi + pip install -e .[memprof,mpi,test] + pytest -n 4 armi diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml index da0381ceb..4dead8224 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/unittests.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - python: ['3.12'] + python: [3.9, '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/validatemanifest.yaml b/.github/workflows/validatemanifest.yaml new file mode 100644 index 000000000..acd640208 --- /dev/null +++ b/.github/workflows/validatemanifest.yaml @@ -0,0 +1,19 @@ +name: Validate Manifest + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Validate Manifest + run: | + pip install toml + python .github/workflows/validatemanifest.py diff --git a/.github/workflows/wintests.yaml b/.github/workflows/wintests.yaml new file mode 100644 index 000000000..e141cb14a --- /dev/null +++ b/.github/workflows/wintests.yaml @@ -0,0 +1,30 @@ +name: ARMI Windows tests + +on: + push: + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Upgrade PIP + run: python -m pip install --upgrade pip + - name: Run Unit Tests on Windows + run: | + pip install mpi4py==3.1.6 + pip install -e .[memprof,mpi,test] + pytest -n 4 armi + - name: Find Test Crumbs + run: python .github/workflows/find_test_crumbs.py diff --git a/pyproject.toml b/pyproject.toml index 69cf588c2..8d74fb8b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,8 @@ authors = [ ] dependencies = [ "coverage>=7.2.0", # Code coverage tool. Sadly baked into every Case. - "h5py>=3.9", # Needed because our database files are H5 format + "h5py>=3.9 ; python_version >= '3.11.0'", # Needed because our database files are H5 format + "h5py>=3.0,<=3.9 ; python_version < '3.11.0'", "htmltree>=0.7.6", # Our reports have HTML output "matplotlib>=3.5.3,<3.8.0", # Important plotting library "numpy>=1.21", # Important math library @@ -39,8 +40,10 @@ dependencies = [ "pluggy>=1.2.0", # Central tool behind the ARMI Plugin system "pyDOE>=0.3.8", # We import a Latin-hypercube algorithm to explore a phase space "pyevtk>=1.2.0", # Handles binary VTK visualization files - "ruamel.yaml.clib", # C-based core of ruamel below - "ruamel.yaml", # Our foundational YAML library + "ruamel.yaml.clib ; python_version >= '3.11.0'", # C-based core of ruamel below + "ruamel.yaml ; python_version >= '3.11.0'", # Our foundational YAML library + "ruamel.yaml.clib<=0.2.7 ; python_version < '3.11.0'", # C-based core of ruamel below + "ruamel.yaml<=0.17.21 ; python_version < '3.11.0'", # Our foundational YAML library "scipy>=1.7.0", # Used for curve-fitting and matrix math "tabulate>=0.8.9", # Used to pretty-print tabular data "toml>0.9.5", # Needed to parse the pyproject.toml file @@ -58,6 +61,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Information Analysis", ] From 4ff962d3e3274d15488123eac97ea0a560efa9eb Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 8 Aug 2024 15:35:27 -0700 Subject: [PATCH 12/12] Adding release note --- doc/release/0.4.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release/0.4.rst b/doc/release/0.4.rst index 3c506a5f1..42ceaf62e 100644 --- a/doc/release/0.4.rst +++ b/doc/release/0.4.rst @@ -8,6 +8,7 @@ Release Date: TBD New Features ------------ +#. ARMI now supports Python 3.12. (`PR#1813 `_) #. TBD API Changes