From bac71c7d06a4ccb74c6197a8ae0c008205ffefe0 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 10:35:51 -0600 Subject: [PATCH 01/61] Deleted all gitlab CI work. --- .gitlab-ci.yml | 167 ------------------------------------------ templates/install.yml | 37 ---------- templates/test.yml | 15 ---- 3 files changed, 219 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 templates/install.yml delete mode 100644 templates/test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d486b16a..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,167 +0,0 @@ -image: python:latest - -include: - - templates/install.yml - - templates/test.yml - -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -default: - artifacts: - expire_in: 7 day - -after_script: - - export PATH=$(echo "$PATH" | sed -e 's/:\/data\/gitlab-runner\/.conda\/envs\/experiment_analysis_mcnpy\/$//') - - echo $PATH - - conda deactivate - -.job_template: &install-boiler - stage: build - extends: .install - when: delayed - start_in: 1 minutes - variables: - PYTHON_VER: "3.8" - -install-3.8: - stage: build - extends: .install - variables: - PYTHON_VER: "3.8" - -install-3.9: - <<: *install-boiler - variables: - PYTHON_VER: "3.9" - - -install-3.10: - <<: *install-boiler - variables: - PYTHON_VER: "3.10" - -install-3.11: - <<: *install-boiler - variables: - PYTHON_VER: "3.11" - -install-3.12: - <<: *install-boiler - variables: - PYTHON_VER: "3.12" - -coverage_unit_test: - stage: test - coverage: '/TOTAL.+ ([0-9\.]{1,5}%)/' - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo $PATH - - echo "Executing unit tests" - - which python - - pip freeze - - coverage run -m pytest --junitxml=test_report.xml - - coverage report - - coverage xml - artifacts: - reports: - junit: test_report.xml - coverage_report: - coverage_format: cobertura - path: coverage.xml - needs: ["install-3.8"] - -# skip 3.8 because of coverage test - -.job_template: &test_config - stage: test - extends: .test_no_cover - -unit_test-3.9: - <<: *test_config - variables: - PYTHON_VER: "3.9" - needs: ["coverage_unit_test","install-3.9"] - -unit_test-3.10: - <<: *test_config - variables: - PYTHON_VER: "3.10" - needs: ["coverage_unit_test","install-3.10"] - -unit_test-3.11: - <<: *test_config - variables: - PYTHON_VER: "3.11" - needs: ["coverage_unit_test","install-3.11"] - -unit_test-3.12: - <<: *test_config - variables: - PYTHON_VER: "3.12" - needs: ["coverage_unit_test","install-3.12"] - -doc_test: - stage: test - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Executing Sphinx build to detect syntax errors" - - sphinx-build doc/source/ doc/build/ -W --keep-going -E - - sphinx-build -b html doc/source/ doc/build/html - - mv doc/build/html html - needs: ["install-3.8"] - artifacts: - expose_as: 'Updated Documentation' - paths: - - html - expire_in: 1 day - -format_test: - stage: test - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Testing if anything is unformatted" - - echo "If error occurs changes were not formatted using black" - - black --check montepy/ tests/ - needs: ["install-3.8"] - - - -pages: - stage: deploy - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Building documentation with Sphinx." - - cd doc/ - - make html - - cd .. - - mv doc/build/html public - - python -m build --sdist --wheel - - mv dist/ public/dist - artifacts: - paths: - - public - only: - - master - - main - - doc - - -packaging: - stage: deploy - script: - - rm dist/* - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - pip install build twine - - python -m build --sdist --wheel - - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - - only: - - master - - main diff --git a/templates/install.yml b/templates/install.yml deleted file mode 100644 index 8ccea7bb..00000000 --- a/templates/install.yml +++ /dev/null @@ -1,37 +0,0 @@ -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -.install: - script: - - if [[ -d dist ]]; then rm -r dist ; fi; - - if [[ `conda env list` == *"$CONDA_BASE_NAME-$PYTHON_VER"* ]]; then - - else - - conda create -n $CONDA_BASE_NAME-$PYTHON_VER -y python==$PYTHON_VER - - fi - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - echo "Installing dependencies" - - which python - - which pip - - pip uninstall -y montepy - # make alternate package to confuse the builder. - - if [[ -d fake_py ]]; then mkdir fake_py; fi; - - if [[ -f fake_py/__init__.py ]]; then - - touch fake_py/__init__.py - - fi - # install base requirements first - - pip install -r requirements/common.txt - # needed to build. Users shouldn't be doing this on their own. - # Want to make sure it can be installed without dev stuff. - - pip install build - - python -m build --sdist --wheel - - pip install . - - pip uninstall -y montepy - - pip install --user dist/*.whl - # test the extras installation - - pip install --user montepy[test] - - pip install --user montepy[doc] - - pip freeze - artifacts: - paths: - - dist/ diff --git a/templates/test.yml b/templates/test.yml deleted file mode 100644 index 5284fd9b..00000000 --- a/templates/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -.test_no_cover: - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - which python - - pip freeze - - python -m pytest --junitxml=test_report.xml - artifacts: - reports: - junit: test_report.xml - From 6a14b71ade254958d6cbb497acf7e7b9d3d07951 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:08:24 -0600 Subject: [PATCH 02/61] Removed pytest.ini --- pyproject.toml | 2 ++ pytest.ini | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index 6dd48dad..5bed2826 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,3 +69,5 @@ exclude_also = [ [tool.pytest.ini_options] minversion = "6.0" junit_logging = "all" +junit_family="xunit2" +filterwarnings="error" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 731f942b..00000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -junit_family=xunit2 -filterwarnings=error From 4846286f8aaeffc24c4e63b8918b2ed3553f711f Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:24:14 -0600 Subject: [PATCH 03/61] Moved all requirements to pypyroject.toml --- pyproject.toml | 21 ++++++++++++++++----- requirements/common.txt | 2 -- requirements/dev.txt | 8 -------- 3 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 requirements/common.txt delete mode 100644 requirements/dev.txt diff --git a/pyproject.toml b/pyproject.toml index 5bed2826..534453cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,7 @@ description = "A library for reading, editing, and writing MCNP input files" # gitlab limits the readme to 4,000 chars. readme = "README.md" requires-python = ">=3.8" -maintainers = [ - {name = "Micah Gale", email = "micah.gale@inl.gov"} -] +maintainers = {name="Micah Gale", email="micah.gale@inl.gov"} authors = [ {name = "Micah Gale", email = "micah.gale@inl.gov"}, {name = "Travis Labossiere-Hickman", email = "Travis.LabossiereHickman@inl.gov"}, @@ -30,13 +28,26 @@ classifiers = [ ] dependencies = [ - "numpy", + "numpy>=1.18", "sly==0.5" ] [project.optional-dependencies] -test = ["coverage", "pytest"] +test = ["coverage[toml]>=6.3.2", "pytest"] doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] +format = ["black>23.3.0"] +build = [ + "build", + "setuptool_scm", + "bump2version" +] +develop = [ + "montepy[test]", + "montepy[doc]", + "montepy[format]", + "montepy[build]", +] + [project.urls] Homepage = "https://idaholab.github.io/MontePy/index.html" diff --git a/requirements/common.txt b/requirements/common.txt deleted file mode 100644 index 97e31a82..00000000 --- a/requirements/common.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy >= 1.18 -sly >= 0.5.0 diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index c73727e3..00000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,8 +0,0 @@ --r common.txt -build -sphinx~=4.3 -sphinxcontrib-apidoc -sphinx_rtd_theme -coverage[toml]>=6.3.2 -pytest -black==23.3.0 From 4c33d4aeead116f9f7095666ad90b435fa373d0e Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:28:15 -0600 Subject: [PATCH 04/61] Updated actions to not use requirements anymore. --- .github/workflows/deploy.yml | 6 +++--- .github/workflows/main.yml | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e75139c7..9de7ea0c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user -r requirements/dev.txt + - run: pip install montepy[develop] - run: python -m pytest build-pages: @@ -75,7 +75,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install build + - run: python -m pip install montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -96,7 +96,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install build + - run: python -m pip install montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d635a22b..9216a003 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - run: pip install --upgrade pip build - - run: pip install -r requirements/common.txt + - run: pip install build - run: python -m build --sdist --wheel - run: pip install . - run: pip uninstall -y montepy @@ -25,6 +25,9 @@ jobs: - run: pip install --user dist/*.tar.gz - run: pip install --user montepy[test] - run: pip install --user montepy[doc] + - run: pip install --user montepy[format] + - run: pip install --user montepy[build] + - run: pip install --user montepy[develop] - run: pip freeze - name: Upload build artifacts uses: actions/upload-artifact@v3 @@ -44,7 +47,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - run: pip install --user -r requirements/dev.txt + - run: pip install --user montepy[test] - run: coverage run -m pytest --junitxml=test_report.xml - run: coverage report - run: coverage xml @@ -85,7 +88,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user -r requirements/dev.txt + - run: pip install montepy[format] - run: black --check montepy/ tests/ From bf175fddcaa931b6de6d11693862126d852ab6d6 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:35:34 -0600 Subject: [PATCH 05/61] Fixed bad maintainers. --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 534453cb..ccf38d32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,9 @@ description = "A library for reading, editing, and writing MCNP input files" # gitlab limits the readme to 4,000 chars. readme = "README.md" requires-python = ">=3.8" -maintainers = {name="Micah Gale", email="micah.gale@inl.gov"} +maintainers = [ + {name = "Micah Gale", email = "micah.gale@inl.gov"} +] authors = [ {name = "Micah Gale", email = "micah.gale@inl.gov"}, {name = "Travis Labossiere-Hickman", email = "Travis.LabossiereHickman@inl.gov"}, From 0eef2c18464cdcb6693b66d3dd2ed9df9ced7f60 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:38:20 -0600 Subject: [PATCH 06/61] Relaxed black requirement. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ccf38d32..9725cc3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ dependencies = [ [project.optional-dependencies] test = ["coverage[toml]>=6.3.2", "pytest"] doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] -format = ["black>23.3.0"] +format = ["black>=23.3.0"] build = [ "build", "setuptool_scm", From d166e43a47826fad2c9aee3d5d4a21fc8f81e337 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:44:38 -0600 Subject: [PATCH 07/61] Had pip defer to local for installing. --- .github/workflows/deploy.yml | 8 ++++---- .github/workflows/main.yml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9de7ea0c..b5321f62 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[develop] + - run: pip install . montepy[develop] - run: python -m pytest build-pages: @@ -30,7 +30,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user montepy[doc] + - run: pip install --user . montepy[doc] - run: cd doc && make html - uses: actions/configure-pages@v4 - uses: actions/upload-pages-artifact@v3 @@ -75,7 +75,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install montepy[build] + - run: python -m pip install . montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -96,7 +96,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install montepy[build] + - run: python -m pip install . montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9216a003..01283017 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,11 +23,11 @@ jobs: - run: pip install --user dist/*.whl - run: pip uninstall -y montepy - run: pip install --user dist/*.tar.gz - - run: pip install --user montepy[test] - - run: pip install --user montepy[doc] - - run: pip install --user montepy[format] - - run: pip install --user montepy[build] - - run: pip install --user montepy[develop] + - run: pip install --user . montepy[test] + - run: pip install --user . montepy[doc] + - run: pip install --user . montepy[format] + - run: pip install --user . montepy[build] + - run: pip install --user . montepy[develop] - run: pip freeze - name: Upload build artifacts uses: actions/upload-artifact@v3 @@ -47,7 +47,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - run: pip install --user montepy[test] + - run: pip install --user . montepy[test] - run: coverage run -m pytest --junitxml=test_report.xml - run: coverage report - run: coverage xml @@ -71,7 +71,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[doc] + - run: pip install . montepy[doc] - run: sphinx-build doc/source/ doc/build/ -W --keep-going -E - run: sphinx-build -b html doc/source/ doc/build/html - uses: actions/upload-artifact@v3 @@ -88,7 +88,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[format] + - run: pip install . montepy[format] - run: black --check montepy/ tests/ From 373cfac26605cc2098757161e2dc9cd989bdde3e Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:16:05 -0600 Subject: [PATCH 08/61] Correct setuptools-scm dependency --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9725cc3e..20f93952 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] format = ["black>=23.3.0"] build = [ "build", - "setuptool_scm", + "setuptools_scm>=8", "bump2version" ] develop = [ @@ -58,9 +58,12 @@ Documentation = "https://idaholab.github.io/MontePy/index.html" "Bug Tracker" = "https://github.com/idaholab/MontePy/issues" [build-system] -requires = ["setuptools >= 61.0.0"] +requires = ["setuptools >= 64.0.0", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +version_file = "montepy/_version.py" + [tool.setuptools.packages.find] include = ["montepy*"] From 88ad4f8f4c0959baf054630e7db5366289735eca Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:27:54 -0600 Subject: [PATCH 09/61] Ignoring version file from setuptools_scm --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18762426..990257f6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ doc/build/* .coverage .idea/ .ipynb_checkpoints/ +montepy/_version.py From 9fb3b123bfa53f77d1f01ab0b6bba3c26cc5523e Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:53:03 -0600 Subject: [PATCH 10/61] Implemented Coveralls with a lot of trial and error. --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01283017..2d7f1663 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,10 +57,14 @@ jobs: name: test path: test_report.xml - name: Upload coverage report - uses: actions/upload-artifact@v3 + if: ${{ matrix.python-version == '3.9' }} + uses: actions/upload-artifact@v4 with: name: coverage path: coverage.xml + - name: Coveralls GitHub Action + if: ${{ matrix.python-version == '3.9' }} + uses: coverallsapp/github-action@v2.2.3 doc-test: runs-on: ubuntu-latest From 4f1c6b65bef34a4ce14914b586bf16f54e70af41 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 10:35:51 -0600 Subject: [PATCH 11/61] Deleted all gitlab CI work. --- .gitlab-ci.yml | 167 ------------------------------------------ templates/install.yml | 37 ---------- templates/test.yml | 15 ---- 3 files changed, 219 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 templates/install.yml delete mode 100644 templates/test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d486b16a..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,167 +0,0 @@ -image: python:latest - -include: - - templates/install.yml - - templates/test.yml - -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -default: - artifacts: - expire_in: 7 day - -after_script: - - export PATH=$(echo "$PATH" | sed -e 's/:\/data\/gitlab-runner\/.conda\/envs\/experiment_analysis_mcnpy\/$//') - - echo $PATH - - conda deactivate - -.job_template: &install-boiler - stage: build - extends: .install - when: delayed - start_in: 1 minutes - variables: - PYTHON_VER: "3.8" - -install-3.8: - stage: build - extends: .install - variables: - PYTHON_VER: "3.8" - -install-3.9: - <<: *install-boiler - variables: - PYTHON_VER: "3.9" - - -install-3.10: - <<: *install-boiler - variables: - PYTHON_VER: "3.10" - -install-3.11: - <<: *install-boiler - variables: - PYTHON_VER: "3.11" - -install-3.12: - <<: *install-boiler - variables: - PYTHON_VER: "3.12" - -coverage_unit_test: - stage: test - coverage: '/TOTAL.+ ([0-9\.]{1,5}%)/' - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo $PATH - - echo "Executing unit tests" - - which python - - pip freeze - - coverage run -m pytest --junitxml=test_report.xml - - coverage report - - coverage xml - artifacts: - reports: - junit: test_report.xml - coverage_report: - coverage_format: cobertura - path: coverage.xml - needs: ["install-3.8"] - -# skip 3.8 because of coverage test - -.job_template: &test_config - stage: test - extends: .test_no_cover - -unit_test-3.9: - <<: *test_config - variables: - PYTHON_VER: "3.9" - needs: ["coverage_unit_test","install-3.9"] - -unit_test-3.10: - <<: *test_config - variables: - PYTHON_VER: "3.10" - needs: ["coverage_unit_test","install-3.10"] - -unit_test-3.11: - <<: *test_config - variables: - PYTHON_VER: "3.11" - needs: ["coverage_unit_test","install-3.11"] - -unit_test-3.12: - <<: *test_config - variables: - PYTHON_VER: "3.12" - needs: ["coverage_unit_test","install-3.12"] - -doc_test: - stage: test - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Executing Sphinx build to detect syntax errors" - - sphinx-build doc/source/ doc/build/ -W --keep-going -E - - sphinx-build -b html doc/source/ doc/build/html - - mv doc/build/html html - needs: ["install-3.8"] - artifacts: - expose_as: 'Updated Documentation' - paths: - - html - expire_in: 1 day - -format_test: - stage: test - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Testing if anything is unformatted" - - echo "If error occurs changes were not formatted using black" - - black --check montepy/ tests/ - needs: ["install-3.8"] - - - -pages: - stage: deploy - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - echo "Building documentation with Sphinx." - - cd doc/ - - make html - - cd .. - - mv doc/build/html public - - python -m build --sdist --wheel - - mv dist/ public/dist - artifacts: - paths: - - public - only: - - master - - main - - doc - - -packaging: - stage: deploy - script: - - rm dist/* - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - pip install build twine - - python -m build --sdist --wheel - - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - - only: - - master - - main diff --git a/templates/install.yml b/templates/install.yml deleted file mode 100644 index 8ccea7bb..00000000 --- a/templates/install.yml +++ /dev/null @@ -1,37 +0,0 @@ -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -.install: - script: - - if [[ -d dist ]]; then rm -r dist ; fi; - - if [[ `conda env list` == *"$CONDA_BASE_NAME-$PYTHON_VER"* ]]; then - - else - - conda create -n $CONDA_BASE_NAME-$PYTHON_VER -y python==$PYTHON_VER - - fi - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - echo "Installing dependencies" - - which python - - which pip - - pip uninstall -y montepy - # make alternate package to confuse the builder. - - if [[ -d fake_py ]]; then mkdir fake_py; fi; - - if [[ -f fake_py/__init__.py ]]; then - - touch fake_py/__init__.py - - fi - # install base requirements first - - pip install -r requirements/common.txt - # needed to build. Users shouldn't be doing this on their own. - # Want to make sure it can be installed without dev stuff. - - pip install build - - python -m build --sdist --wheel - - pip install . - - pip uninstall -y montepy - - pip install --user dist/*.whl - # test the extras installation - - pip install --user montepy[test] - - pip install --user montepy[doc] - - pip freeze - artifacts: - paths: - - dist/ diff --git a/templates/test.yml b/templates/test.yml deleted file mode 100644 index 5284fd9b..00000000 --- a/templates/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -variables: - PYTHON_VER: "3.8" - CONDA_BASE_NAME: experiment_analysis_montepy - -.test_no_cover: - script: - - conda activate $CONDA_BASE_NAME-$PYTHON_VER - - export PATH="~/.local/bin/:/data/gitlab-runner/.conda/envs/$CONDA_BASE_NAME-$PYTHON_VER/bin:$PATH" - - which python - - pip freeze - - python -m pytest --junitxml=test_report.xml - artifacts: - reports: - junit: test_report.xml - From 5bd80516d400fe5594f735674343c0cefecf7a75 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:08:24 -0600 Subject: [PATCH 12/61] Removed pytest.ini --- pyproject.toml | 2 ++ pytest.ini | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index 6dd48dad..5bed2826 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,3 +69,5 @@ exclude_also = [ [tool.pytest.ini_options] minversion = "6.0" junit_logging = "all" +junit_family="xunit2" +filterwarnings="error" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 731f942b..00000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -junit_family=xunit2 -filterwarnings=error From 5549e7645e1aba545b6a1301bebd42a58f5fc145 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:24:14 -0600 Subject: [PATCH 13/61] Moved all requirements to pypyroject.toml --- pyproject.toml | 21 ++++++++++++++++----- requirements/common.txt | 2 -- requirements/dev.txt | 8 -------- 3 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 requirements/common.txt delete mode 100644 requirements/dev.txt diff --git a/pyproject.toml b/pyproject.toml index 5bed2826..534453cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,7 @@ description = "A library for reading, editing, and writing MCNP input files" # gitlab limits the readme to 4,000 chars. readme = "README.md" requires-python = ">=3.8" -maintainers = [ - {name = "Micah Gale", email = "micah.gale@inl.gov"} -] +maintainers = {name="Micah Gale", email="micah.gale@inl.gov"} authors = [ {name = "Micah Gale", email = "micah.gale@inl.gov"}, {name = "Travis Labossiere-Hickman", email = "Travis.LabossiereHickman@inl.gov"}, @@ -30,13 +28,26 @@ classifiers = [ ] dependencies = [ - "numpy", + "numpy>=1.18", "sly==0.5" ] [project.optional-dependencies] -test = ["coverage", "pytest"] +test = ["coverage[toml]>=6.3.2", "pytest"] doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] +format = ["black>23.3.0"] +build = [ + "build", + "setuptool_scm", + "bump2version" +] +develop = [ + "montepy[test]", + "montepy[doc]", + "montepy[format]", + "montepy[build]", +] + [project.urls] Homepage = "https://idaholab.github.io/MontePy/index.html" diff --git a/requirements/common.txt b/requirements/common.txt deleted file mode 100644 index 97e31a82..00000000 --- a/requirements/common.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy >= 1.18 -sly >= 0.5.0 diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index c73727e3..00000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,8 +0,0 @@ --r common.txt -build -sphinx~=4.3 -sphinxcontrib-apidoc -sphinx_rtd_theme -coverage[toml]>=6.3.2 -pytest -black==23.3.0 From 9b3e70e93010feb9a31e30496d71cd7bac053196 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:28:15 -0600 Subject: [PATCH 14/61] Updated actions to not use requirements anymore. --- .github/workflows/deploy.yml | 6 +++--- .github/workflows/main.yml | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e75139c7..9de7ea0c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user -r requirements/dev.txt + - run: pip install montepy[develop] - run: python -m pytest build-pages: @@ -75,7 +75,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install build + - run: python -m pip install montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -96,7 +96,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install build + - run: python -m pip install montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d635a22b..9216a003 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - run: pip install --upgrade pip build - - run: pip install -r requirements/common.txt + - run: pip install build - run: python -m build --sdist --wheel - run: pip install . - run: pip uninstall -y montepy @@ -25,6 +25,9 @@ jobs: - run: pip install --user dist/*.tar.gz - run: pip install --user montepy[test] - run: pip install --user montepy[doc] + - run: pip install --user montepy[format] + - run: pip install --user montepy[build] + - run: pip install --user montepy[develop] - run: pip freeze - name: Upload build artifacts uses: actions/upload-artifact@v3 @@ -44,7 +47,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - run: pip install --user -r requirements/dev.txt + - run: pip install --user montepy[test] - run: coverage run -m pytest --junitxml=test_report.xml - run: coverage report - run: coverage xml @@ -85,7 +88,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user -r requirements/dev.txt + - run: pip install montepy[format] - run: black --check montepy/ tests/ From a80b73dc04579107168fe11fb5ca251da2a4a86c Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:35:34 -0600 Subject: [PATCH 15/61] Fixed bad maintainers. --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 534453cb..ccf38d32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,9 @@ description = "A library for reading, editing, and writing MCNP input files" # gitlab limits the readme to 4,000 chars. readme = "README.md" requires-python = ">=3.8" -maintainers = {name="Micah Gale", email="micah.gale@inl.gov"} +maintainers = [ + {name = "Micah Gale", email = "micah.gale@inl.gov"} +] authors = [ {name = "Micah Gale", email = "micah.gale@inl.gov"}, {name = "Travis Labossiere-Hickman", email = "Travis.LabossiereHickman@inl.gov"}, From 987350b3557cb6875d0accc633796c64de940684 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:38:20 -0600 Subject: [PATCH 16/61] Relaxed black requirement. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ccf38d32..9725cc3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ dependencies = [ [project.optional-dependencies] test = ["coverage[toml]>=6.3.2", "pytest"] doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] -format = ["black>23.3.0"] +format = ["black>=23.3.0"] build = [ "build", "setuptool_scm", From 0bba8209680519bdc66136e2d820d1f836889a5e Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 11:44:38 -0600 Subject: [PATCH 17/61] Had pip defer to local for installing. --- .github/workflows/deploy.yml | 8 ++++---- .github/workflows/main.yml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9de7ea0c..b5321f62 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[develop] + - run: pip install . montepy[develop] - run: python -m pytest build-pages: @@ -30,7 +30,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install --user montepy[doc] + - run: pip install --user . montepy[doc] - run: cd doc && make html - uses: actions/configure-pages@v4 - uses: actions/upload-pages-artifact@v3 @@ -75,7 +75,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install montepy[build] + - run: python -m pip install . montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -96,7 +96,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: python -m pip install montepy[build] + - run: python -m pip install . montepy[build] - run: python -m build --sdist --wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9216a003..01283017 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,11 +23,11 @@ jobs: - run: pip install --user dist/*.whl - run: pip uninstall -y montepy - run: pip install --user dist/*.tar.gz - - run: pip install --user montepy[test] - - run: pip install --user montepy[doc] - - run: pip install --user montepy[format] - - run: pip install --user montepy[build] - - run: pip install --user montepy[develop] + - run: pip install --user . montepy[test] + - run: pip install --user . montepy[doc] + - run: pip install --user . montepy[format] + - run: pip install --user . montepy[build] + - run: pip install --user . montepy[develop] - run: pip freeze - name: Upload build artifacts uses: actions/upload-artifact@v3 @@ -47,7 +47,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - run: pip install --user montepy[test] + - run: pip install --user . montepy[test] - run: coverage run -m pytest --junitxml=test_report.xml - run: coverage report - run: coverage xml @@ -71,7 +71,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[doc] + - run: pip install . montepy[doc] - run: sphinx-build doc/source/ doc/build/ -W --keep-going -E - run: sphinx-build -b html doc/source/ doc/build/html - uses: actions/upload-artifact@v3 @@ -88,7 +88,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - run: pip install montepy[format] + - run: pip install . montepy[format] - run: black --check montepy/ tests/ From c836d611aa484265e23164f6e1596838b157375c Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:16:05 -0600 Subject: [PATCH 18/61] Correct setuptools-scm dependency --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9725cc3e..20f93952 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ doc = ["sphinx", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] format = ["black>=23.3.0"] build = [ "build", - "setuptool_scm", + "setuptools_scm>=8", "bump2version" ] develop = [ @@ -58,9 +58,12 @@ Documentation = "https://idaholab.github.io/MontePy/index.html" "Bug Tracker" = "https://github.com/idaholab/MontePy/issues" [build-system] -requires = ["setuptools >= 61.0.0"] +requires = ["setuptools >= 64.0.0", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +version_file = "montepy/_version.py" + [tool.setuptools.packages.find] include = ["montepy*"] From 044ae17133da18009e0f0f050cd74493b3bf173c Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:27:54 -0600 Subject: [PATCH 19/61] Ignoring version file from setuptools_scm --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18762426..990257f6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ doc/build/* .coverage .idea/ .ipynb_checkpoints/ +montepy/_version.py From cea94538a58eb651e4e6a4a1330d8968aba7e32a Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 12:53:03 -0600 Subject: [PATCH 20/61] Implemented Coveralls with a lot of trial and error. --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01283017..2d7f1663 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,10 +57,14 @@ jobs: name: test path: test_report.xml - name: Upload coverage report - uses: actions/upload-artifact@v3 + if: ${{ matrix.python-version == '3.9' }} + uses: actions/upload-artifact@v4 with: name: coverage path: coverage.xml + - name: Coveralls GitHub Action + if: ${{ matrix.python-version == '3.9' }} + uses: coverallsapp/github-action@v2.2.3 doc-test: runs-on: ubuntu-latest From fbcc3a785880448653dd57a66378dba18b551e81 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 13:56:48 -0600 Subject: [PATCH 21/61] Ignore _version from coverage. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 20f93952..fe4d871d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ version = {attr = "montepy.__version__"} [tool.coverage.run] source = ["montepy"] +omit = ["montepy/_version.py"] [tool.coverage.report] precision = 2 From b0cf2df53f189fdecb686295c4ea57b680d2c7ca Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 14:13:57 -0600 Subject: [PATCH 22/61] Limited coveralls to coverage.xml only.P --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2d7f1663..ad0deba7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,6 +65,8 @@ jobs: - name: Coveralls GitHub Action if: ${{ matrix.python-version == '3.9' }} uses: coverallsapp/github-action@v2.2.3 + with: + file: coverage.xml doc-test: runs-on: ubuntu-latest From 196ef9b9f2a63c46942ebf2c7e2d44b9aca4f67d Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:28:13 -0600 Subject: [PATCH 23/61] Added basic badges --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8eee6eff..3169d0e8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ MontePY: a cute snek on a red over white circle +[![license](https://img.shields.io/github/license/idaholab/MontePy.svg)](https://github.com/idaholab/MontePy/blob/develop/LICENSE) +[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) +[![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy) + A python library to read, edit, and write MCNP input files. ## Installing From 53af432a0d53123077b0d9b51856f269c5775587 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:34:55 -0600 Subject: [PATCH 24/61] First try with using test reporter. --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad0deba7..af8c30ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,7 +52,8 @@ jobs: - run: coverage report - run: coverage xml - name: Upload test report - uses: actions/upload-artifact@v3 + if: ${{ matrix.python-version == '3.9' }} + uses: actions/upload-artifact@v4 with: name: test path: test_report.xml @@ -62,6 +63,11 @@ jobs: with: name: coverage path: coverage.xml + - name: Test Reporter + if: ${{ matrix.python-version == '3.9' }} + uses: dorny/test-reporter@v1.7.0 + with: + path: test_report.xml - name: Coveralls GitHub Action if: ${{ matrix.python-version == '3.9' }} uses: coverallsapp/github-action@v2.2.3 From 907c082728f49a0567bdf9909e5125f3632d5dca Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:39:27 -0600 Subject: [PATCH 25/61] Added name to test reporter. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af8c30ec..fc433ce6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,6 +67,7 @@ jobs: if: ${{ matrix.python-version == '3.9' }} uses: dorny/test-reporter@v1.7.0 with: + name: CI path: test_report.xml - name: Coveralls GitHub Action if: ${{ matrix.python-version == '3.9' }} From e23c441c92aceaf95e8be71bc6f2216e2886abb7 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:41:31 -0600 Subject: [PATCH 26/61] Added reporter to test reporter. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fc433ce6..e6740755 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,6 +69,7 @@ jobs: with: name: CI path: test_report.xml + reporter: java-junit - name: Coveralls GitHub Action if: ${{ matrix.python-version == '3.9' }} uses: coverallsapp/github-action@v2.2.3 From 2ec0bcd6aff5f7c83811d557ff3acf33cf5e54cf Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:45:13 -0600 Subject: [PATCH 27/61] Made test names more meaningful. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6740755..268da249 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Test package +name: CI testing on: [push] @@ -67,7 +67,7 @@ jobs: if: ${{ matrix.python-version == '3.9' }} uses: dorny/test-reporter@v1.7.0 with: - name: CI + name: CI-test-report path: test_report.xml reporter: java-junit - name: Coveralls GitHub Action From 165693690685537f542b74e86aebf3a81b4e8911 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 14:55:26 -0600 Subject: [PATCH 28/61] Actually implemented a build and deploy phase --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b5321f62..3742ce1d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,6 +37,22 @@ jobs: with: name: deploy-pages path: doc/build/html/ + + build-packages: + runs-on: ubuntu-latest + needs: [last-minute-test] + steps: + - uses: actions/checkout@v4 + - name: set up python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - run: pip install . montepy[build] + - run: python -m build . + - uses: actions/upload-artifact@v4 + with: + name: build + path: dist/* deploy-pages: permissions: @@ -65,18 +81,16 @@ jobs: environment: name: test-pypi url: https://test.pypi.org/p/montepy # Replace with your PyPI project name - needs: [deploy-pages] + needs: [deploy-pages, build-packages] permissions: contents: read id-token: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/download-artifact@v4 with: - python-version: 3.8 - - run: python -m pip install . montepy[build] - - run: python -m build --sdist --wheel + name: build + - uses: actions/setup-python@v4 - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -86,18 +100,15 @@ jobs: environment: name: pypi url: https://pypi.org/p/montepy # Replace with your PyPI project name - needs: [deploy-pages, deploy-test-pypi] + needs: [deploy-pages, deploy-test-pypi, build-packages] permissions: contents: read id-token: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/download-artifact@v4 with: - python-version: 3.8 - - run: python -m pip install . montepy[build] - - run: python -m build --sdist --wheel + name: build - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From be49ab7b63ae0a8ad6d5b00b16fdb7a4191b69d3 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 15:04:52 -0600 Subject: [PATCH 29/61] Cleaned up pypi deploy --- .github/workflows/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3742ce1d..698c8e46 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,7 +40,6 @@ jobs: build-packages: runs-on: ubuntu-latest - needs: [last-minute-test] steps: - uses: actions/checkout@v4 - name: set up python 3.8 @@ -90,7 +89,6 @@ jobs: - uses: actions/download-artifact@v4 with: name: build - - uses: actions/setup-python@v4 - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From 1d0136a3ff013773553a43d0262f8a83c1b960ee Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 15:28:05 -0600 Subject: [PATCH 30/61] Switched version system fully over to Setuptools-scm --- montepy/__init__.py | 10 +++++++++- pyproject.toml | 3 --- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/montepy/__init__.py b/montepy/__init__.py index ac195ceb..eae7e6a8 100644 --- a/montepy/__init__.py +++ b/montepy/__init__.py @@ -23,7 +23,15 @@ from montepy.universe import Universe import sys -__version__ = "0.2.5" +try: + from . import _version + __version__ = _version.version +except ImportError: + try: + from setuptools_scm import get_version + __version__ = get_version() + except ImportError: + __version__ = "Undefined" # enable deprecated warnings for users if not sys.warnoptions: diff --git a/pyproject.toml b/pyproject.toml index fe4d871d..cebc4ff0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,9 +67,6 @@ version_file = "montepy/_version.py" [tool.setuptools.packages.find] include = ["montepy*"] -[tool.setuptools.dynamic] -version = {attr = "montepy.__version__"} - [tool.coverage.run] source = ["montepy"] omit = ["montepy/_version.py"] From 0823e031e4333beb5291419f9d1691067c977398 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 15:28:31 -0600 Subject: [PATCH 31/61] Made a version command line argument. --- montepy/__main__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/montepy/__main__.py b/montepy/__main__.py index ae39fb05..11680140 100644 --- a/montepy/__main__.py +++ b/montepy/__main__.py @@ -34,6 +34,12 @@ def define_args(args): help="Check the given input file(s) for errors. Accepts globs, and multiple arguments.", metavar="input_file", ) + parser.add_argument( + "-v", + "--version", + action="store_true", + help="Print the version number", + ) args = parser.parse_args(args) return args @@ -59,8 +65,10 @@ def main(): # pragma: no cover The main function """ args = define_args(sys.argv[1:]) - if "check" in args: + if "check" in args and args.check: check_inputs(args.check) + if args.version: + print(montepy.__version__) if __name__ == "__main__": # pragma: no cover From ce33238278e570c27df701bdb2df0b0b7e528478 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sun, 21 Jan 2024 15:33:54 -0600 Subject: [PATCH 32/61] Switched to having GHA automatically change version numbers. --- .github/workflows/deploy.yml | 12 +++++++++++- pyproject.toml | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 698c8e46..b4771070 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,9 @@ on: push: branches: [main] +env: + RELEASE_LEVEL: patch + jobs: last-minute-test: runs-on: ubuntu-latest @@ -19,7 +22,6 @@ jobs: build-pages: environment: name: github-pages - url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Configure git @@ -40,13 +42,21 @@ jobs: build-packages: runs-on: ubuntu-latest + needs: [last-minute-test] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: set up python 3.8 uses: actions/setup-python@v4 with: python-version: 3.8 - run: pip install . montepy[build] + - name: GitHub Actions Create Tag + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - run: python -m build . - uses: actions/upload-artifact@v4 with: diff --git a/pyproject.toml b/pyproject.toml index cebc4ff0..51979030 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,6 @@ format = ["black>=23.3.0"] build = [ "build", "setuptools_scm>=8", - "bump2version" ] develop = [ "montepy[test]", From b2482ddd5f0ac3ca6070f6ac17329370b9d95a95 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 16:27:05 -0600 Subject: [PATCH 33/61] Made GHA create automatic releases. --- .github/workflows/deploy.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b4771070..252751f2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -41,8 +41,14 @@ jobs: path: doc/build/html/ build-packages: + name: Build, sign, and release packages on github runs-on: ubuntu-latest needs: [last-minute-test] + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + env: + GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 with: @@ -54,14 +60,39 @@ jobs: python-version: 3.8 - run: pip install . montepy[build] - name: GitHub Actions Create Tag + id: tag_version uses: mathieudutour/github-tag-action@v6.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} + # ensure tags are up to date + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - run: python -m build . + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create a GitHub release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.tag_version.outputs.new_tag }} + name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} + draft: true + - run: >- + gh release upload + '${{ steps.tag_version.outputs.new_tag }}' dist/** + --repo '${{ github.repository }}' - uses: actions/upload-artifact@v4 with: name: build - path: dist/* + path: | + dist/*.tar.gz + dist/*.whl deploy-pages: permissions: @@ -99,6 +130,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: build + path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -117,8 +149,10 @@ jobs: - uses: actions/download-artifact@v4 with: name: build + path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + From fc06ee317e398c58a18b5f1f8b28fcaad57627f7 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 21 Jan 2024 20:51:27 -0600 Subject: [PATCH 34/61] Created pull request template Adapted from OpenMC: https://github.com/openmc-dev/openmc/blob/develop/.github/pull_request_template.md --- .github/pull_request_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..34bc845b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,21 @@ + + +# Description + +Please include a summary of the change and which issue is fixed if applicable. Please also include relevant motivation and context. + +Fixes # (issue) + +# Checklist + +- [ ] I have performed a self-review of my own code +- [ ] I have made corresponding changes to the documentation (if applicable) +- [ ] I have added tests that prove my fix is effective or that my feature works (if applicable) + From 7019777c84d4ae44c32d66aae595d918e9476603 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 14:40:16 -0600 Subject: [PATCH 35/61] Added documentation on how versioning now works. --- doc/source/developing.rst | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/source/developing.rst b/doc/source/developing.rst index c6ec53a2..5d9c2485 100644 --- a/doc/source/developing.rst +++ b/doc/source/developing.rst @@ -77,19 +77,40 @@ Setting up and Typical Development Workflow Deploy Process ^^^^^^^^^^^^^^ -MontePy currently does not use a continuous deploy process. -Rather changes are staged on the ``develop`` branch prior to a release. +MontePy currently does not use a continuous deploy (CD) process. +Changes are staged on the ``develop`` branch prior to a release. Both ``develop`` and ``main`` are protected branches. -``main`` should only be used for releases. +``main`` is only be used for releases. If someone clones ``main`` they will get the most recent official release. Only a select few core-developers are allowed to approve a merge to ``main`` and therefore a new release. -``develop`` should be production quality code that has been approved for release, +``develop`` is for production quality code that has been approved for release, but is waiting on the next release. So all new features and bug fixes must first be merged onto ``develop``. The expectation is that features once merged onto ``develop`` are stable, well tested, well documented, and well-formatted. +Automated Versioning +^^^^^^^^^^^^^^^^^^^^ + +As part of the CD process a new version number is created. +The `GitHub action `_ that does this goes through the following process: + +1. Finds the last release version as git tags. +2. Analyzes all commit messages since then to determine if this is a Major, Minor, or Patch release. +3. Creates a tag with the apropriately incremented new release version. + +This means that git commit messages needs to convey the appropriate level of information. +The library uses `angular's commit message conventions `_. +This convention will not be enforced for all commits, +but will be for all merge commits from Pull Requests. + +Additional References: + +1. `github action `_ +1. `angular's commit message conventions `_ +1. `Semantic versioning standard `_ + Merge Checklist ^^^^^^^^^^^^^^^ From caf2d810eb7b75e79223de94c9d9c93b0f3a91d3 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 14:46:29 -0600 Subject: [PATCH 36/61] Switched run to on pull_request to allow running on fork --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce76eb98..b6257636 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ name: CI testing -on: [push] +on: [pull_request] jobs: build: From 85af4cfa90daaa3bee23057c26ecbc556762d2fe Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 15:43:43 -0600 Subject: [PATCH 37/61] Reformatted code with black. --- montepy/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/montepy/__init__.py b/montepy/__init__.py index eae7e6a8..fdb96396 100644 --- a/montepy/__init__.py +++ b/montepy/__init__.py @@ -25,10 +25,12 @@ try: from . import _version + __version__ = _version.version except ImportError: try: from setuptools_scm import get_version + __version__ = get_version() except ImportError: __version__ = "Undefined" From 314838fb4e5ccedc434b2da2245ab0101998e759 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 15:55:18 -0600 Subject: [PATCH 38/61] Updated permissions for test reporter. --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b6257636..b79e0d86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,6 +2,10 @@ name: CI testing on: [pull_request] +permissions: + contents: read + actions: read + checks: write jobs: build: runs-on: ubuntu-latest From 1a3f878a809a7a74031b2702e78ed306391720c1 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 16:02:33 -0600 Subject: [PATCH 39/61] Tried to actually set permissions. --- .github/workflows/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b79e0d86..01b6e151 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,10 +2,7 @@ name: CI testing on: [pull_request] -permissions: - contents: read - actions: read - checks: write + jobs: build: runs-on: ubuntu-latest @@ -41,6 +38,10 @@ jobs: test: runs-on: ubuntu-latest + permissions: + contents: read + actions: read + checks: write strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] From f54bec62064c1ec594f859a09cc56f43f44af8c0 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 16:10:21 -0600 Subject: [PATCH 40/61] Tried yolo permissions --- .github/workflows/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01b6e151..46913d6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,10 +38,7 @@ jobs: test: runs-on: ubuntu-latest - permissions: - contents: read - actions: read - checks: write + permissions: write-all strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] From b9b9fbac16fa3375e14f5fd3b30ec97d874abe03 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 25 Jan 2024 17:20:41 -0600 Subject: [PATCH 41/61] Revert "Updated permissions for test reporter." This reverts commit 314838fb4e5ccedc434b2da2245ab0101998e759. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46913d6b..e7a5f1de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,6 @@ name: CI testing on: [pull_request] - jobs: build: runs-on: ubuntu-latest From 983087d14b7a71ccb05fd78bedda70ddb0c00e8e Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:16:12 -0600 Subject: [PATCH 42/61] Fixed bad grammar. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3169d0e8..11897449 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ There is also a developer's guide covering the design and approach of MontePy, a * Can parse the following surfaces exactly P(X|Y|Z), C(X|Y|Z), C/(X|Y|Z) (I mean it can do PX, and PY, etc.) * Can read in all other inputs but not understand them * Can write out full MCNP problem even if it doesn't fully understand an input. -* Can write out the MCNP problem verbatim, and try to match +* Can write out the MCNP problem verbatim, and try to match the original user formatting. * Can quickly access cells, surfaces, and materials by their numbers. For example: `cell = problem.cells[105]`. * Can quickly update cell importances. For example `cell.importance.neutron = 2.0`. * Has over 240 test cases right now From 71a98470eca8ede7a73ded3b4ec90d1128e9a091 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:27:30 -0600 Subject: [PATCH 43/61] Added DOI to code. --- doc/source/index.rst | 2 ++ doc/source/publications.rst | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 doc/source/publications.rst diff --git a/doc/source/index.rst b/doc/source/index.rst index be171a76..4a0b1bd4 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -18,6 +18,8 @@ Welcome to MontePy's documentation! api/modules + publications + See Also ======== diff --git a/doc/source/publications.rst b/doc/source/publications.rst new file mode 100644 index 00000000..c8820728 --- /dev/null +++ b/doc/source/publications.rst @@ -0,0 +1,15 @@ +Publications +============ + +Permanent Link to Software +-------------------------- + +* `DOI:10.11578/dc.20240115.1 `_ + + +Journals and Conference Papers +------------------------------ + +Currently we don't have any articles to show here. +If you have an interesting paper that uses MontePy, +open an issue and we may add it here. From 0df59d11e1c17836581d0c37debd8ad4ca3f6c50 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:51:55 -0600 Subject: [PATCH 44/61] Created test script for finding missing documentation. --- doc/source/_test_for_missing_docs.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 doc/source/_test_for_missing_docs.py diff --git a/doc/source/_test_for_missing_docs.py b/doc/source/_test_for_missing_docs.py new file mode 100644 index 00000000..0729f2db --- /dev/null +++ b/doc/source/_test_for_missing_docs.py @@ -0,0 +1,33 @@ +import glob +import os +import sys +import warnings + +ignored = {"__pycache__", "_version.py", "__main__.py"} + +base = os.path.join("..", "..") + + +def crawl_path(rel_path): + missing = False + for f in os.listdir(os.path.join(base, rel_path)): + f_name = os.path.join(rel_path, f) + if f in ignored: + continue + if os.path.isdir(os.path.join(base, f_name)): + crawl_path(f_name) + elif os.path.isfile(os.path.join(base, f_name)) and ".py" in f: + if f == "__init__.py": + f_name = os.path.join(rel_path, ".py") + path = f_name.replace("/", ".").replace(".py", ".rst") + if not os.path.exists(os.path.join("api", path)): + missing = True + warnings.warn( + f"Missing sphinx documentation for {os.path.join(rel_path, f)}" + ) + return missing + + +missing = crawl_path("montepy") +if missing: + sys.exit(314) From 7a405933f60fe7feca0adf6fd40023541674b13d Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:53:31 -0600 Subject: [PATCH 45/61] Ran test as part of doc test. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e7a5f1de..1cfaa0c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,6 +94,8 @@ jobs: with: name: website path: doc/build/html + - run: cd doc/source + - run: python _test_for_missing_docs.py format-test: runs-on: ubuntu-latest From 2400a8af3bf7f1f3e983a674f9557728b8b39cf3 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:58:36 -0600 Subject: [PATCH 46/61] Fixed bug with how __init__ was treated. --- doc/source/_test_for_missing_docs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/_test_for_missing_docs.py b/doc/source/_test_for_missing_docs.py index 0729f2db..05f8925c 100644 --- a/doc/source/_test_for_missing_docs.py +++ b/doc/source/_test_for_missing_docs.py @@ -18,8 +18,9 @@ def crawl_path(rel_path): crawl_path(f_name) elif os.path.isfile(os.path.join(base, f_name)) and ".py" in f: if f == "__init__.py": - f_name = os.path.join(rel_path, ".py") - path = f_name.replace("/", ".").replace(".py", ".rst") + path = f_name.replace("/", ".").replace(".__init__.py", ".rst") + else: + path = f_name.replace("/", ".").replace(".py", ".rst") if not os.path.exists(os.path.join("api", path)): missing = True warnings.warn( From b7428347e5f1e022e7204b75382243001e18e7bb Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 21:59:30 -0600 Subject: [PATCH 47/61] Updated version of black --- montepy/data_inputs/fill.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/montepy/data_inputs/fill.py b/montepy/data_inputs/fill.py index cd18f1fa..82e6d5d6 100644 --- a/montepy/data_inputs/fill.py +++ b/montepy/data_inputs/fill.py @@ -525,9 +525,11 @@ def _value_node_generator(): payload.append(self.universes[i][j][k].number) else: payload = [ - self.universe.number - if self.universe is not None - else self.old_universe_number + ( + self.universe.number + if self.universe is not None + else self.old_universe_number + ) ] try: start_transform = new_vals.index("(") From d694d0e245db35fe7c556d5e8378a44015ffa3b4 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:04:47 -0600 Subject: [PATCH 48/61] Added missing documentation files. --- doc/source/api/montepy.data_inputs.tally.rst | 8 ++++++++ doc/source/api/montepy.data_inputs.tally_multiplier.rst | 8 ++++++++ doc/source/api/montepy.input_parser.input_file.rst | 8 ++++++++ doc/source/api/montepy.input_parser.tally_parser.rst | 8 ++++++++ 4 files changed, 32 insertions(+) create mode 100644 doc/source/api/montepy.data_inputs.tally.rst create mode 100644 doc/source/api/montepy.data_inputs.tally_multiplier.rst create mode 100644 doc/source/api/montepy.input_parser.input_file.rst create mode 100644 doc/source/api/montepy.input_parser.tally_parser.rst diff --git a/doc/source/api/montepy.data_inputs.tally.rst b/doc/source/api/montepy.data_inputs.tally.rst new file mode 100644 index 00000000..dc16f381 --- /dev/null +++ b/doc/source/api/montepy.data_inputs.tally.rst @@ -0,0 +1,8 @@ +montepy.data\_inputs.tally module +================================= + + +.. automodule:: montepy.data_inputs.tally + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/montepy.data_inputs.tally_multiplier.rst b/doc/source/api/montepy.data_inputs.tally_multiplier.rst new file mode 100644 index 00000000..f38e1552 --- /dev/null +++ b/doc/source/api/montepy.data_inputs.tally_multiplier.rst @@ -0,0 +1,8 @@ +montepy.data\_inputs.tally_multiplier module +============================================ + + +.. automodule:: montepy.data_inputs.tally_multiplier + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/montepy.input_parser.input_file.rst b/doc/source/api/montepy.input_parser.input_file.rst new file mode 100644 index 00000000..6f552e8d --- /dev/null +++ b/doc/source/api/montepy.input_parser.input_file.rst @@ -0,0 +1,8 @@ +montepy.input\_parser.input\_file module +========================================== + + +.. automodule:: montepy.input_parser.input_file + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/montepy.input_parser.tally_parser.rst b/doc/source/api/montepy.input_parser.tally_parser.rst new file mode 100644 index 00000000..65756dde --- /dev/null +++ b/doc/source/api/montepy.input_parser.tally_parser.rst @@ -0,0 +1,8 @@ +montepy.input\_parser.tally\_parser module +========================================== + + +.. automodule:: montepy.input_parser.tally\_parser + :members: + :undoc-members: + :show-inheritance: From 80b370a3f701598173679ac97917a09709378a7a Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:05:05 -0600 Subject: [PATCH 49/61] Ignored private file. --- doc/source/_test_for_missing_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/_test_for_missing_docs.py b/doc/source/_test_for_missing_docs.py index 05f8925c..f0dbf9a7 100644 --- a/doc/source/_test_for_missing_docs.py +++ b/doc/source/_test_for_missing_docs.py @@ -3,7 +3,7 @@ import sys import warnings -ignored = {"__pycache__", "_version.py", "__main__.py"} +ignored = {"__pycache__", "_version.py", "__main__.py", "_cell_data_control.py"} base = os.path.join("..", "..") From 4a413aa915ec65e9c7c069e464b3ce1a22381407 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:07:30 -0600 Subject: [PATCH 50/61] Actually added new files to the TOC. --- doc/source/api/montepy.data_inputs.rst | 2 ++ doc/source/api/montepy.input_parser.rst | 2 ++ doc/source/api/montepy.input_parser.tally_parser.rst | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/source/api/montepy.data_inputs.rst b/doc/source/api/montepy.data_inputs.rst index e4248fb2..96bdae1e 100644 --- a/doc/source/api/montepy.data_inputs.rst +++ b/doc/source/api/montepy.data_inputs.rst @@ -26,6 +26,8 @@ Submodules montepy.data_inputs.material_component montepy.data_inputs.mode montepy.data_inputs.thermal_scattering + montepy.data_inputs.tally + montepy.data_inputs.tally_multiplier montepy.data_inputs.transform montepy.data_inputs.universe_input montepy.data_inputs.volume diff --git a/doc/source/api/montepy.input_parser.rst b/doc/source/api/montepy.input_parser.rst index 5ffd32e2..89fa0dc0 100644 --- a/doc/source/api/montepy.input_parser.rst +++ b/doc/source/api/montepy.input_parser.rst @@ -18,11 +18,13 @@ Submodules montepy.input_parser.data_parser montepy.input_parser.input_reader montepy.input_parser.input_syntax_reader + montepy.input_parser.input_file montepy.input_parser.mcnp_input montepy.input_parser.parser_base montepy.input_parser.read_parser montepy.input_parser.shortcuts montepy.input_parser.surface_parser montepy.input_parser.syntax_node + montepy.input_parser.tally_parser montepy.input_parser.thermal_parser montepy.input_parser.tokens diff --git a/doc/source/api/montepy.input_parser.tally_parser.rst b/doc/source/api/montepy.input_parser.tally_parser.rst index 65756dde..eaf525b2 100644 --- a/doc/source/api/montepy.input_parser.tally_parser.rst +++ b/doc/source/api/montepy.input_parser.tally_parser.rst @@ -2,7 +2,7 @@ montepy.input\_parser.tally\_parser module ========================================== -.. automodule:: montepy.input_parser.tally\_parser +.. automodule:: montepy.input_parser.tally_parser :members: :undoc-members: :show-inheritance: From 508f932b73e295c3584b384db8d627cc302ec57e Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:12:00 -0600 Subject: [PATCH 51/61] Tried to get cd to persist --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1cfaa0c8..939c3b93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,8 +94,8 @@ jobs: with: name: website path: doc/build/html - - run: cd doc/source - - run: python _test_for_missing_docs.py + - run: | cd doc/source + python _test_for_missing_docs.py format-test: runs-on: ubuntu-latest From 04f30d495cf5e413d713d31a553fc75502913043 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:14:08 -0600 Subject: [PATCH 52/61] Fixed syntax. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 939c3b93..bdef0a22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,7 +94,8 @@ jobs: with: name: website path: doc/build/html - - run: | cd doc/source + - run: | + cd doc/source python _test_for_missing_docs.py format-test: From c9ebe7092f58f36883653a0047abe98c8ca62ada Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Wed, 31 Jan 2024 22:16:05 -0600 Subject: [PATCH 53/61] Named missing api test --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bdef0a22..c107a575 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,7 +94,8 @@ jobs: with: name: website path: doc/build/html - - run: | + - name: Test for missing API documentation + run: | cd doc/source python _test_for_missing_docs.py From 108018f20bee4b2815d250932189157b72774965 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Thu, 1 Feb 2024 17:15:55 -0600 Subject: [PATCH 54/61] Get that good SEO. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11897449..860b3edb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) [![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy) -A python library to read, edit, and write MCNP input files. +MontePy is a python library to read, edit, and write MCNP input files. ## Installing From f4032f35f8bda6ee8ecac3f9c3bf1d59512e2006 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sat, 3 Feb 2024 23:44:21 -0600 Subject: [PATCH 55/61] Updated test to run after merge for protected branches --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c107a575..42bd6d5f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ name: CI testing -on: [pull_request] +on: + pull_request: + push: + branches: [develop, main, alpha-test] jobs: build: From 8bfe485772e4a087fd9312cb60b9af0322ea79e1 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Tue, 6 Feb 2024 15:22:44 -0600 Subject: [PATCH 56/61] Update bug_report.md to prompt users to do the right thing --- .github/ISSUE_TEMPLATE/bug_report.md | 68 ++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 46c1f24f..125612f4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,32 +6,74 @@ labels: bug assignees: '' --- - + **Describe the bug** + A clear and concise description of what the bug is. **To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error -**Expected behavior** -A clear and concise description of what you expected to happen. +A short code snippet of what you have ran. Please change or remove any specific values or anything that can't be public. For example: + +``` python +problem = montepy.read_input("foo.imcnp") +``` + +**Error Message (if any)** + +If an error message was printed please include the entire stacktrace. If it includes any specific values please change or remove them. For example: + +``` python +In [6]: problem.cells.append(copy.deepcopy(cell)) +--------------------------------------------------------------------------- +NumberConflictError Traceback (most recent call last) +Cell In[6], line 1 +----> 1 problem.cells.append(copy.deepcopy(cell)) + +File ~/dev/montepy/montepy/numbered_object_collection.py:202, in NumberedObjectCollection.append(self, obj) + 200 raise TypeError(f"object being appended must be of type: {self._obj_class}") + 201 if obj.number in self.numbers: +--> 202 raise NumberConflictError( + 203 ( + 204 "There was a numbering conflict when attempting to add " + 205 f"{obj} to {type(self)}. Conflict was with {self[obj.number]}" + 206 ) + 207 ) + 208 else: + 209 self.__num_cache[obj.number] = obj -**Screenshots** -If applicable, add screenshots to help explain your problem. +NumberConflictError: There was a numbering conflict when attempting to add CELL: 3, mat: 3, DENS: 1.0 g/cm3 to . Conflict was with CELL: 3, mat: 3, DENS: 1.0 g/cm3 +``` + +**MCNP input file snippet** + +If applicable, please include a small section of the input file you were working on. If it includes any specific values please change or remove them. For example: + +``` +1 1 20 + -1000 $ dollar comment + imp:n,p=1 U=350 trcl=5 + +C surfaces +1000 SO 1 + +C data +C materials +C UO2 5 atpt enriched +m1 92235.80c 5 & +92238.80c 95 +``` + +**Version** -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - Version [e.g. 0.2.5] **Additional context** + Add any other context about the problem here. From d7e7de63a79890ac42b45449ac5ce7d18a8c3b21 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Mon, 5 Feb 2024 16:47:02 -0600 Subject: [PATCH 57/61] Removed unused vars. --- .github/workflows/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 252751f2..c4fc82f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,8 +4,6 @@ on: push: branches: [main] -env: - RELEASE_LEVEL: patch jobs: last-minute-test: From 65a463bb6d166a15e7c17d9deaad2ed413fb5c03 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Mon, 5 Feb 2024 16:50:16 -0600 Subject: [PATCH 58/61] Fixed typo with bug reports labels. --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 125612f4..77fd90ba 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: bug +labels: bugs assignees: '' --- From 0c5f3e26052ae640e2f0cc8f0d1353df7f7ae7db Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Mon, 5 Feb 2024 16:52:27 -0600 Subject: [PATCH 59/61] Switched to implicit sys.argv. --- montepy/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/montepy/__main__.py b/montepy/__main__.py index 11680140..3fec69c7 100644 --- a/montepy/__main__.py +++ b/montepy/__main__.py @@ -14,7 +14,7 @@ """ -def define_args(args): +def define_args(args=None): """ Sets and parses the command line arguments. @@ -64,7 +64,7 @@ def main(): # pragma: no cover """ The main function """ - args = define_args(sys.argv[1:]) + args = define_args() if "check" in args and args.check: check_inputs(args.check) if args.version: From 0d7fbe611f6372ba0288f005a0804afa8036bf0b Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Mon, 5 Feb 2024 16:53:50 -0600 Subject: [PATCH 60/61] Removed unecessary check. --- montepy/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/montepy/__main__.py b/montepy/__main__.py index 3fec69c7..5141ea4b 100644 --- a/montepy/__main__.py +++ b/montepy/__main__.py @@ -65,7 +65,7 @@ def main(): # pragma: no cover The main function """ args = define_args() - if "check" in args and args.check: + if args.check: check_inputs(args.check) if args.version: print(montepy.__version__) From bfbd0c9a52115063b57b5a2c3730f6972eca1eea Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Tue, 13 Feb 2024 17:55:57 -0600 Subject: [PATCH 61/61] Removed dubplicate TOC entry for input_file. --- doc/source/api/montepy.input_parser.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/api/montepy.input_parser.rst b/doc/source/api/montepy.input_parser.rst index abf8a2df..fc837495 100644 --- a/doc/source/api/montepy.input_parser.rst +++ b/doc/source/api/montepy.input_parser.rst @@ -19,7 +19,6 @@ Submodules montepy.input_parser.input_file montepy.input_parser.input_reader montepy.input_parser.input_syntax_reader - montepy.input_parser.input_file montepy.input_parser.mcnp_input montepy.input_parser.parser_base montepy.input_parser.read_parser