Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.2.5 #5

Merged
merged 23 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1891f8f
Replicated the error in #163.
MicahGale Jan 5, 2024
d0f5f9d
Defined recursive GeometryTree Comments function for nested dicts.
MicahGale Jan 5, 2024
dd2e914
Deleted accidental debug statement.
MicahGale Jan 8, 2024
90e3152
Merge branch 'develop' into 163-error-in-cell-comments
MicahGale Jan 10, 2024
38b5356
Create Github Actions (#2)
MicahGale Jan 11, 2024
0570167
Update README.md for github
MicahGale Jan 11, 2024
6ca8fb5
Happy new year!
MicahGale Jan 11, 2024
8119c79
Reved version.
MicahGale Jan 11, 2024
dc28388
Updated URLs to github in pyproject
MicahGale Jan 11, 2024
c7b020a
Create Github Actions (#2)
MicahGale Jan 11, 2024
91fdcd3
Merge remote-tracking branch 'gh-origin/develop' into develop
MicahGale Jan 11, 2024
790538e
Reved version for release.
MicahGale Jan 11, 2024
c60fd09
Only want deploy to happen when the merge actually happens.
MicahGale Jan 11, 2024
9ab7bfd
Merge branch 'develop' into README-update
MicahGale Jan 12, 2024
4b6079a
Merge pull request #3 from idaholab/README-update
MicahGale Jan 12, 2024
ba8fab1
Update issue templates
MicahGale Jan 11, 2024
d0b0428
updated link to issue in dev.
MicahGale Jan 12, 2024
33dd0d2
Updated hyperlink for MCNP 6.2 manual
MicahGale Jan 15, 2024
51caa3d
Merge pull request #6 from idaholab/gh-actions-fix
MicahGale Jan 15, 2024
b6ef7de
Added feature request tag to issue template
MicahGale Jan 15, 2024
017d8ab
Merge branch 'develop' into issue-templates
MicahGale Jan 15, 2024
427585a
Merge pull request #7 from idaholab/issue-templates
MicahGale Jan 15, 2024
720b2cd
Merge branch 'main' into develop
MicahGale Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Reminders**
1. This is not a place to debug your MCNP models
1. MCNP is export controlled and only its 6.2 and 6.3 user manuals are public. Don't include any information about MCNP which is not in those manuals.
1. Your model may be export controlled, or proprietary. Please change specific numbers (e.g., dimensions, material compositions, etc.) in your minimum working examples.

**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.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**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.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'feature request'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

**Reminder**
Only the MCNP 6.2 and 6.3 user manuals are public. If this discusses a feature of MCNP you could only know by running MCNP please do not include it.
105 changes: 105 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Deploy

on:
push:
branches: [main]

jobs:
last-minute-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- run: pip install --user -r requirements/dev.txt
- run: python -m pytest

build-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Configure git
env:
TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
- 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/

deploy-pages:
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: [build-pages, last-minute-test]
runs-on: ubuntu-latest
steps:
- run: ls -l
- uses: actions/download-artifact@v4
with:
name: deploy-pages
- run: ls -l
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: deploy-pages


deploy-test-pypi:
environment:
name: test-pypi
url: https://test.pypi.org/p/montepy # Replace <package-name> with your PyPI project name
needs: [deploy-pages]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: python -m pip install build
- run: python -m build --sdist --wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

deploy-pypi:
environment:
name: pypi
url: https://pypi.org/p/montepy # Replace <package-name> with your PyPI project name
needs: [deploy-pages, deploy-test-pypi]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: python -m pip install build
- run: python -m build --sdist --wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1



91 changes: 91 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Test package

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip build
- run: pip install -r requirements/common.txt
- run: python -m build --sdist --wheel
- run: pip install .
- run: pip uninstall -y montepy
- 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 freeze
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: dist/*

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install --user -r requirements/dev.txt
- run: coverage run -m pytest --junitxml=test_report.xml
- run: coverage report
- run: coverage xml
- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: test
path: test_report.xml
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.xml

doc-test:
runs-on: ubuntu-latest

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[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

format-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: set up python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- run: pip install --user -r requirements/dev.txt
- run: black --check montepy/ tests/


16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# MontePy

<img src="https://raw.githubusercontent.com/idaholab/MontePy/develop/graphics/monty.svg" width="180" alt="MontePY: a cute snek on a red over white circle"/>

A python library to read, edit, and write MCNP input files.

## Installing

See the [Installing section in the user guide](https://experiment_analysis_all.pages.hpc.inl.gov/software/montepy/starting.html#installing).
See the [Installing section in the user guide](https://idaholab.github.io/MontePy/starting.html#installing).


## User Documentation

MontePy has a [sphinx website](https://experiment_analysis_all.pages.hpc.inl.gov/software/montepy/).
MontePy has a [sphinx website](https://idaholab.github.io/MontePy/index.html).
This has a getting started guide for users,
as well as API documentation.
There is also a developer's guide covering the design and approach of MontePy, and how to contribute.
Expand All @@ -19,9 +21,9 @@ There is also a developer's guide covering the design and approach of MontePy, a
* Handles almost all MCNP input syntax including: message blocks, & continue, comments, etc.
* Parses Cells, surfaces, materials, and transforms very well.
* 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 cards but not understand them
* Can write out full MCNP problem even if it doesn't fully understand a card.
* Can write out the MCNP problem verbatim, if it has not been modified at all.
* 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 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
Expand Down Expand Up @@ -56,7 +58,7 @@ So MontePy doesn't do what you want? Right now development is done with a Just-
If there's a feature you want add an issue here with the feature request tag.
If you want to add a feature on your own talk to Micah Gale (but still add the issue).
The system is very modular and you should be able to develop it pretty quickly.
Also read the [developer's guide](https://experiment_analysis_all.pages.hpc.inl.gov/software/montepy/developing.html).
Also read the [developer's guide](https://idaholab.github.io/MontePy/developing.html).

# Version Numbering Scheme

Expand All @@ -70,4 +72,4 @@ Also read the [developer's guide](https://experiment_analysis_all.pages.hpc.inl.
Official shall not change. New merges to main shall have a version number incremented.


# Finally: make objects not regexs!
# Finally: make objects not regexes!
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# -- Project information -----------------------------------------------------

project = "MontePy"
copyright = "2021 – 2023, Battelle Energy Alliance LLC."
author = "Micah D. Gale (@galemica), Travis J. Labossiere-Hickman (@tjlaboss)"
copyright = "2021 – 2024, Battelle Energy Alliance LLC."
author = "Micah D. Gale (@micahgale), Travis J. Labossiere-Hickman (@tjlaboss)"


release = importlib.metadata.version("montepy")
Expand Down
2 changes: 1 addition & 1 deletion doc/source/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ How to __str__ vs __repr__
""""""""""""""""""""""""""
All objects must implement ``__str__`` (called by ``str()``),
and ``__repr__`` (called by ``repr()``).
See `this issue <https://hpcgitlab.hpc.inl.gov/experiment_analysis/montepy/-/issues/41>`_ for a more detailed discussion.
See `this issue <https://github.com/idaholab/MontePy/issues/82>`_ for a more detailed discussion.
In general ``__str__`` should return a one line string with enough information to uniquely identify the object.
For numbered objects this should include their number, and a few high level details.
For ``__repr__`` this should include debugging information.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ See Also
========

* `MontePy github Repository <https://github.com/idaholab/montepy>`_
* `MCNP 6.2 User Manual <https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-17-29981.pdf>`_
* `MCNP 6.2 User Manual <https://mcnp.lanl.gov/pdf_files/TechReport_2017_LANL_LA-UR-17-29981_WernerArmstrongEtAl.pdf>`_
* `MCNP 6.3 User Manual <https://mcnp.lanl.gov/pdf_files/TechReport_2022_LANL_LA-UR-22-30006Rev.1_KuleszaAdamsEtAl.pdf>`_

Indices and tables
Expand Down
3 changes: 2 additions & 1 deletion montepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from montepy.universe import Universe
import sys

__version__ = "0.2.4"
__version__ = "0.2.5"

# enable deprecated warnings for users
if not sys.warnoptions:
import os, warnings
Expand Down
3 changes: 1 addition & 2 deletions montepy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ def __init__(self, message):

class MalformedInputError(ValueError):
"""
<<<<<<< HEAD
Raised when there is an error with the MCNP input not related to the parser.
Raised when there is an error with the MCNP input not related to the parser.
"""

def __init__(self, input, message):
Expand Down
15 changes: 13 additions & 2 deletions montepy/input_parser/syntax_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,19 @@ def format(self):

@property
def comments(self):
for node in self.nodes.values():
yield from node.comments
for key, node in self.nodes.items():
if isinstance(node, SyntaxNodeBase):
yield from node.comments
elif isinstance(node, dict):
yield from GeometryTree._recurse_comments(node)

@staticmethod
def _recurse_comments(tree):
for node in tree.values():
if isinstance(node, SyntaxNodeBase):
yield from node.comments
elif isinstance(node, dict):
yield from GeometryTree._recurse_comments(node)

@property
def left(self):
Expand Down
Loading