Skip to content

Commit 1068d69

Browse files
authored
Merge pull request #608 from idaholab/alpha-test-dev
1.0.0 alpha to develop staging: YOLO merge.
2 parents b8c692a + 26cf851 commit 1068d69

File tree

120 files changed

+11820
-5093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+11820
-5093
lines changed

.github/scripts/check_version.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
3+
import argparse
4+
import re
5+
import sys
6+
from setuptools_scm import get_version
7+
8+
parser = argparse.ArgumentParser()
9+
parser.add_argument("-a", "--alpha", action="store_true")
10+
DEPLOY_VERSION = r"\d+\.\d+\.\d+"
11+
ALPHA_VERSION = DEPLOY_VERSION + r"a\d+"
12+
args = parser.parse_args()
13+
if args.alpha:
14+
print("checking alpha release")
15+
parser = ALPHA_VERSION
16+
else:
17+
print("checking Final release.")
18+
parser = DEPLOY_VERSION
19+
20+
version = get_version()
21+
print(f"version = {version}")
22+
if not re.fullmatch(parser, version):
23+
exit(1)
24+
exit(0)

.github/scripts/check_version.sh

-6
This file was deleted.

.github/workflows/deploy-alpha.yml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Alpha-Deploy
2+
3+
on:
4+
push:
5+
branches: [alpha-test]
6+
7+
8+
jobs:
9+
last-minute-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: set up python 3.12
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.12
17+
- run: pip install . montepy[develop]
18+
- run: python -m pytest
19+
20+
build-packages:
21+
name: Build, sign, and release packages on github
22+
runs-on: ubuntu-latest
23+
needs: [last-minute-test]
24+
permissions:
25+
contents: write # IMPORTANT: mandatory for making GitHub Releases
26+
id-token: write # IMPORTANT: mandatory for sigstore
27+
env:
28+
GH_TOKEN: ${{ github.token }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
fetch-tags: true
34+
- name: set up python 3.12
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: 3.12
38+
- run: pip install . montepy[build]
39+
- name: Get Version
40+
id: get_version
41+
run: echo "version=`python -m setuptools_scm`" >> $GITHUB_OUTPUT
42+
- name: Verify that this is a non-dev alpha release
43+
run: .github/scripts/check_version.py --alpha
44+
- run: python -m build .
45+
- name: Sign the dists with Sigstore
46+
uses: sigstore/gh-action-sigstore-python@v3.0.0
47+
with:
48+
inputs: >-
49+
./dist/*.tar.gz
50+
./dist/*.whl
51+
- name: Create a GitHub release
52+
uses: ncipollo/release-action@v1
53+
with:
54+
tag: v${{ steps.get_version.outputs.version }}
55+
name: Release ${{ steps.get_version.outputs.version }}
56+
draft: true
57+
- run: >-
58+
gh release upload
59+
'v${{ steps.get_version.outputs.version }}' dist/**
60+
--repo '${{ github.repository }}'
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
name: build
64+
path: |
65+
dist/*.tar.gz
66+
dist/*.whl
67+
68+
69+
deploy-test-pypi:
70+
environment:
71+
name: test-pypi
72+
url: https://test.pypi.org/p/montepy # Replace <package-name> with your PyPI project name
73+
needs: [build-packages]
74+
permissions:
75+
contents: read
76+
id-token: write
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/download-artifact@v4
80+
with:
81+
name: build
82+
path: dist/
83+
- name: Publish distribution 📦 to PyPI
84+
uses: pypa/gh-action-pypi-publish@release/v1
85+
with:
86+
repository-url: https://test.pypi.org/legacy/
87+
88+
deploy-pypi:
89+
environment:
90+
name: pypi
91+
url: https://pypi.org/p/montepy # Replace <package-name> with your PyPI project name
92+
needs: [deploy-test-pypi, build-packages]
93+
permissions:
94+
contents: read
95+
id-token: write
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/download-artifact@v4
99+
with:
100+
name: build
101+
path: dist/
102+
- name: Publish distribution 📦 to PyPI
103+
uses: pypa/gh-action-pypi-publish@release/v1
104+
105+
106+
107+

.github/workflows/deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
id: get_version
4242
run: echo "version=`python -m setuptools_scm`" >> $GITHUB_OUTPUT
4343
- name: Verify that this is a non-dev release
44-
run: .github/scripts/check_version.sh ${{ steps.get_version.outputs.version }}
44+
run: .github/scripts/check_version.py
4545
- run: python -m build .
4646
- name: Sign the dists with Sigstore
4747
uses: sigstore/gh-action-sigstore-python@v3.0.0

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI testing
22

33
on:
44
pull_request:
5-
branches: [develop, alpha-test-dev]
5+
branches: [develop, alpha-test-dev, alpha-test]
66
push:
77
branches: [develop, main, alpha-test]
88

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@ doc/build/*
1515
.coverage
1616
.hypothesis/
1717
.idea/
18+
.venv/
1819
.ipynb_checkpoints/
1920
montepy/_version.py
21+
22+
# various testing results
23+
htmlcov
24+
.hypothesis
25+
.mutmut-cache

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Micah D. Gale <micah.gale@inl.gov>
22
Travis J. Labossiere-Hickman <Travis.LabossiereHickman@inl.gov>
33
Brenna A. Carbno <brenna.carbno@inl.gov>
4+
Benjaminas M. <BenjaminasDev@outlook.com>

benchmark/benchmark_big_model.py

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
import gc
2-
import montepy
32

43
import time
54
import tracemalloc
65

7-
FAIL_THRESHOLD = 30
8-
96
tracemalloc.start()
7+
8+
import montepy
9+
10+
FAIL_THRESHOLD = 40
11+
MEMORY_FRACTION = 0.50
12+
13+
starting_mem = tracemalloc.get_traced_memory()[0]
14+
print(f"starting memory with montepy. {starting_mem/1024/1024} MB")
1015
start = time.time()
1116

1217
problem = montepy.read_input("benchmark/big_model.imcnp")
1318

1419
stop = time.time()
1520

21+
problem_mem = tracemalloc.get_traced_memory()[0]
1622
print(f"Took {stop - start} seconds")
17-
print(f"Memory usage report: {tracemalloc.get_traced_memory()[0]/1024/1024} MB")
23+
print(f"Memory usage report: {problem_mem/1024/1024} MB")
1824
del problem
1925
gc.collect()
20-
print(f"Memory usage report after GC: {tracemalloc.get_traced_memory()[0]/1024/1024} MB")
26+
ending_mem = tracemalloc.get_traced_memory()[0]
27+
print(f"Memory usage report after GC: {ending_mem/1024/1024} MB")
2128

2229
if (stop - start) > FAIL_THRESHOLD:
2330
raise RuntimeError(
2431
f"Benchmark took too long to complete. It must be faster than: {FAIL_THRESHOLD} s."
2532
)
33+
34+
prob_gc_mem = problem_mem - ending_mem
35+
prob_actual_mem = problem_mem - starting_mem
36+
gc_ratio = prob_gc_mem / prob_actual_mem
37+
print(f"{gc_ratio:.2%} of the problem's memory was garbage collected.")
38+
if (prob_gc_mem / prob_actual_mem) < MEMORY_FRACTION:
39+
raise RuntimeError(
40+
f"Benchmark had too many memory leaks. Only {gc_ratio:.2%} of the memory was collected."
41+
)

demo/Pin_cell.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"source": [
1010
"import montepy\n",
1111
"import os\n",
12+
"\n",
1213
"montepy.__version__"
1314
]
1415
},
@@ -95,7 +96,7 @@
9596
"metadata": {},
9697
"outputs": [],
9798
"source": [
98-
"#make folder\n",
99+
"# make folder\n",
99100
"os.mkdir(\"parametric\")\n",
100101
"\n",
101102
"fuel_wall = problem.surfaces[1]\n",

doc/source/_test_for_missing_docs.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"_version.py",
1010
"__main__.py",
1111
"_cell_data_control.py",
12+
"_singleton.py"
1213
}
1314

1415
base = os.path.join("..", "..")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
montepy.data_inputs.nuclide module
2+
==================================
3+
4+
5+
.. automodule:: montepy.data_inputs.nuclide
6+
:members:
7+
:inherited-members:
8+
:undoc-members:
9+
:show-inheritance:
10+

doc/source/api/montepy.data_inputs.rst

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ montepy.data\_inputs package
2323
montepy.data_inputs.lattice_input
2424
montepy.data_inputs.material
2525
montepy.data_inputs.material_component
26+
montepy.data_inputs.nuclide
2627
montepy.data_inputs.mode
2728
montepy.data_inputs.thermal_scattering
2829
montepy.data_inputs.transform
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
montepy.input\_parser.material\_parser module
2+
==============================================
3+
4+
5+
.. automodule:: montepy.input_parser.material_parser
6+
:members:
7+
:inherited-members:
8+
:undoc-members:
9+
:show-inheritance:

doc/source/api/montepy.input_parser.rst

+2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ montepy.input\_parser package
1717
montepy.input_parser.input_file
1818
montepy.input_parser.input_reader
1919
montepy.input_parser.input_syntax_reader
20+
montepy.input_parser.material_parser
2021
montepy.input_parser.mcnp_input
2122
montepy.input_parser.parser_base
2223
montepy.input_parser.read_parser
2324
montepy.input_parser.shortcuts
2425
montepy.input_parser.surface_parser
2526
montepy.input_parser.syntax_node
2627
montepy.input_parser.tally_parser
28+
montepy.input_parser.tally_seg_parser
2729
montepy.input_parser.thermal_parser
2830
montepy.input_parser.tokens
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
montepy.input\_parser.tally\_seg\_parser module
2+
===============================================
3+
4+
5+
.. automodule:: montepy.input_parser.tally_seg_parser
6+
:members:
7+
:inherited-members:
8+
:undoc-members:
9+
:show-inheritance:

doc/source/api/montepy.particle.rst

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ montepy.particle module
44

55
.. automodule:: montepy.particle
66
:members:
7-
:inherited-members:
87
:undoc-members:
98
:show-inheritance:

doc/source/api/montepy.surfaces.surface_type.rst

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ montepy.surfaces.surface\_type module
44

55
.. automodule:: montepy.surfaces.surface_type
66
:members:
7-
:inherited-members:
87
:undoc-members:
98
:show-inheritance:

0 commit comments

Comments
 (0)