diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 46c1f24f..77fd90ba 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,36 +2,78 @@ name: Bug report about: Create a report to help us improve title: '' -labels: bug +labels: bugs 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. 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) + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e75139c7..c4fc82f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,7 @@ on: push: branches: [main] + jobs: last-minute-test: runs-on: ubuntu-latest @@ -13,13 +14,12 @@ 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: environment: name: github-pages - url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Configure git @@ -30,13 +30,67 @@ 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 with: name: deploy-pages 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: + 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 + 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/*.tar.gz + dist/*.whl deploy-pages: permissions: @@ -65,18 +119,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 build - - run: python -m build --sdist --wheel + name: build + path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -86,20 +138,19 @@ 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 build - - run: python -m build --sdist --wheel + name: build + path: dist/ - 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 37c21ab9..10507e64 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ -name: Test package +name: CI testing -on: [push] +on: + pull_request: + push: + branches: [develop, main, alpha-test] jobs: build: @@ -16,7 +19,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,8 +28,11 @@ jobs: - run: change_to_ascii -h - 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[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 @@ -36,6 +42,7 @@ jobs: test: runs-on: ubuntu-latest + permissions: write-all strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] @@ -46,20 +53,35 @@ 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 - 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 - 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: Test Reporter + if: ${{ matrix.python-version == '3.9' }} + uses: dorny/test-reporter@v1.7.0 + with: + name: CI-test-report + path: test_report.xml + reporter: java-junit + - 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 @@ -70,13 +92,17 @@ 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 with: name: website path: doc/build/html + - name: Test for missing API documentation + run: | + cd doc/source + python _test_for_missing_docs.py format-test: runs-on: ubuntu-latest @@ -87,7 +113,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/ 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 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/README.md b/README.md index 8eee6eff..860b3edb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,11 @@ MontePY: a cute snek on a red over white circle -A python library to read, edit, and write MCNP input files. +[![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) + +MontePy is a python library to read, edit, and write MCNP input files. ## Installing @@ -23,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 diff --git a/doc/source/_test_for_missing_docs.py b/doc/source/_test_for_missing_docs.py new file mode 100644 index 00000000..f0dbf9a7 --- /dev/null +++ b/doc/source/_test_for_missing_docs.py @@ -0,0 +1,34 @@ +import glob +import os +import sys +import warnings + +ignored = {"__pycache__", "_version.py", "__main__.py", "_cell_data_control.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": + 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( + f"Missing sphinx documentation for {os.path.join(rel_path, f)}" + ) + return missing + + +missing = crawl_path("montepy") +if missing: + sys.exit(314) 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.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 index 03cccada..44ebfc41 100644 --- a/doc/source/api/montepy.input_parser.input_file.rst +++ b/doc/source/api/montepy.input_parser.input_file.rst @@ -2,6 +2,7 @@ montepy.input\_parser.input\_file module ======================================== + .. automodule:: montepy.input_parser.input_file :members: :undoc-members: diff --git a/doc/source/api/montepy.input_parser.rst b/doc/source/api/montepy.input_parser.rst index 72bcd1b4..fc837495 100644 --- a/doc/source/api/montepy.input_parser.rst +++ b/doc/source/api/montepy.input_parser.rst @@ -25,5 +25,6 @@ Submodules 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 new file mode 100644 index 00000000..eaf525b2 --- /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: 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 ^^^^^^^^^^^^^^^ diff --git a/doc/source/index.rst b/doc/source/index.rst index 9998c239..31077195 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -22,6 +22,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. diff --git a/montepy/__init__.py b/montepy/__init__.py index ace5030b..3d966e18 100644 --- a/montepy/__init__.py +++ b/montepy/__init__.py @@ -23,7 +23,18 @@ from montepy.universe import Universe import sys -__version__ = "0.3.0dev1" + +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/montepy/__main__.py b/montepy/__main__.py index ae39fb05..5141ea4b 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. @@ -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 @@ -58,9 +64,11 @@ def main(): # pragma: no cover """ The main function """ - args = define_args(sys.argv[1:]) - if "check" in args: + args = define_args() + if args.check: check_inputs(args.check) + if args.version: + print(montepy.__version__) if __name__ == "__main__": # pragma: no cover 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("(") diff --git a/pyproject.toml b/pyproject.toml index 122589bc..f3a0fe3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,13 +30,25 @@ 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", + "setuptools_scm>=8", +] +develop = [ + "montepy[test]", + "montepy[doc]", + "montepy[format]", + "montepy[build]", +] + [project.urls] Homepage = "https://idaholab.github.io/MontePy/index.html" @@ -48,17 +60,18 @@ Documentation = "https://idaholab.github.io/MontePy/index.html" "change_to_ascii" = "montepy._scripts.change_to_ascii:main" [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*"] -[tool.setuptools.dynamic] -version = {attr = "montepy.__version__"} - [tool.coverage.run] source = ["montepy"] +omit = ["montepy/_version.py"] [tool.coverage.report] precision = 2 @@ -72,3 +85,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 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 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 -