Skip to content

Commit

Permalink
Merge pull request #1 from idaholab/develop
Browse files Browse the repository at this point in the history
Merging disjoint histories for public release.
  • Loading branch information
MicahGale authored Jan 10, 2024
2 parents ebb2f58 + 757486d commit b323df3
Show file tree
Hide file tree
Showing 198 changed files with 23,023 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__pycache__/
build/*
dist/*
*egg-info/*
*.mcnp
.coverage
.idea/*
*.*.sw*
doc/build/*
.coverage
.idea/
.ipynb_checkpoints/
167 changes: 167 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
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
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Micah D. Gale <micah.gale@inl.gov>
Travis J. Labossiere-Hickman <Travis.LabossiereHickman@inl.gov>
Brenna A. Carbno <brenna.carbno@inl.gov>
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# MontePy

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


## User Documentation

MontePy has a [sphinx website](https://experiment_analysis_all.pages.hpc.inl.gov/software/montepy/).
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.

## Features

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


Quick example for renumbering all of the cells in a problem:

```python
import montepy
foo = montepy.read_input("foo.imcnp")
i = 9500
for cell in foo.cells:
cell.number = i
i = i + 5

foo.write_to_file("foo_update.imcnp")

```

## Limitations

Here a few of the known bugs and limitations:


* Cannot handle vertical input mode.
* Does not support tallies in an easy way.
* Does not support source definition in an easy way.

## Bugs, Requests and Development

So MontePy doesn't do what you want? Right now development is done with a Just-In-Time development approach, as in features are added JIT for a developer to use them on my current projects.
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).

# Version Numbering Scheme

* Software on `develop` and feature branches are subject to change without a version number increment. These version
may be suffixed as dev (e.g., `0.1.0.dev2`) and may change as features and bug fixes are implemented.

* Versions are official if and only if they are:
1. on the branch `main`.
1. has a release git tag assigned
1. has distribution packages created and released
Official shall not change. New merges to main shall have a version number incremented.


# Finally: make objects not regexs!
Loading

0 comments on commit b323df3

Please sign in to comment.