Skip to content

Commit f513a51

Browse files
authored
ci(release): allow filtering notes for patch releases (#2523)
Add a --patch argument to the mk_releasenotes.py script which turns develop.toml into LaTeX. Add corresponding option to build_docs.py. This switch will omit everything but fixes from the release notes, suitable for a patch release. (In future maybe consider a more specific LaTeX tag than \ifdevelop, indicating something is a new feature? Then --patch could omit those sections. Maybe --patch could also diff the DFNs and find/omit new options too, so we don't need to mark them with prerelease true. Just thinking ahead.) Also restore a couple new feature items that got accidentally dropped recently
1 parent c47544c commit f513a51

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

distribution/build_docs.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def build_deprecations_tex(force: bool = False):
132132
assert tex_path.is_file()
133133

134134

135-
def build_notes_tex(force: bool = False):
135+
def build_notes_tex(force: bool = False, patch: bool = False):
136136
"""Build LaTeX files for the release notes."""
137137

138138
build_deprecations_tex(force=force)
@@ -144,14 +144,16 @@ def build_notes_tex(force: bool = False):
144144
else:
145145
tex_path.unlink(missing_ok=True)
146146
with set_dir(RELEASE_NOTES_PATH):
147-
out, err, ret = run_py_script(
147+
args = [
148148
"mk_releasenotes.py",
149149
"--toml",
150150
toml_path,
151151
"--tex",
152152
tex_path,
153-
verbose=True,
154-
)
153+
]
154+
if patch:
155+
args.append("--patch")
156+
out, err, ret = run_py_script(*args, verbose=True)
155157
assert not ret, out + err
156158

157159
assert tex_path.is_file()
@@ -390,6 +392,7 @@ def build_documentation(
390392
models: Optional[list[str]] = None,
391393
repo_owner: str = "MODFLOW-ORG",
392394
developmode: bool = True,
395+
patch: bool = False,
393396
):
394397
"""Build documentation for a MODFLOW 6 distribution."""
395398

@@ -412,7 +415,7 @@ def build_documentation(
412415
workspace_path=Path(temp),
413416
example_model_path=PROJ_ROOT_PATH / ".mf6minsim",
414417
)
415-
build_notes_tex(force=force)
418+
build_notes_tex(force=force, patch=patch)
416419

417420
if full:
418421
build_benchmark_tex(out_path=out_path, force=force)
@@ -508,15 +511,27 @@ def test_build_documentation(tmp_path):
508511
"--releasemode",
509512
required=False,
510513
action="store_true",
511-
help="Omit prerelease variables from documentation "
512-
"(defaults to false for development distributions)",
514+
help="Omit prerelease variables/sections from documentation. "
515+
"MF6IO variables marked 'prerelease' are omitted, as well as "
516+
"LaTeX sections surrounded with '\\ifdevelopmode ... \\fi'. "
517+
"Defaults to false.",
518+
)
519+
parser.add_argument(
520+
"--patch",
521+
default=False,
522+
action="store_true",
523+
help="Filter content from documentation for a patch release. "
524+
"Include only items in the 'fixes' section in release notes; "
525+
"that's all this does now, but in the future it may do more. "
526+
"Defaults to false.",
513527
)
514528
args = parser.parse_args()
515529
output_path = Path(args.output_path).expanduser().absolute()
516530
output_path.mkdir(parents=True, exist_ok=True)
517531
bin_path = Path(args.bin_path).expanduser().absolute()
518532
models = args.model if args.model else DEFAULT_MODELS
519533
developmode = not args.releasemode
534+
patch = args.patch
520535
build_documentation(
521536
bin_path=bin_path,
522537
out_path=output_path,
@@ -525,4 +540,5 @@ def test_build_documentation(tmp_path):
525540
models=models,
526541
repo_owner=args.repo_owner,
527542
developmode=developmode,
543+
patch=patch,
528544
)

doc/ReleaseNotes/develop.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ section = "fixes"
5353
subsection = "model"
5454
description = "Fixed ambiguous reporting of cell and subcell events by PRT on DISV grids. Previously subcell exit events and cell exit events were reported with the same event code (1). Subcell events are a tracking method implementation detail, however. Subcell events (and more generally, events occurring at subgrid scale) are no longer included by default in particle tracking output. The PRT Output Control (OC) package's TRACK\\_EXIT option now applies only to features explicitly defined by the grid discretization. Particle events at sub-grid scale are now opt-in with a new keyword option TRACK\\_SUBFEATURE\\_EXIT."
5555

56-
[[item]]
56+
[[items]]
5757
section = "fixes"
5858
subsection = "model"
5959
description = "Fixed two infinite loop conditions in PRT models. First, cyclic paths were possible in the vicinity of assigned boundary faces. When an internal boundary face was assigned (an IFLOWFACE adjacent to another active cell), the adjacent cells could fail to agree on the flow through their shared face, trapping particles in an infinite loop. Particles now terminate at internal assigned boundary faces for which net boundary flow through the face is out of the cell. Particles continue to terminate at all external assigned boundary faces as before. Second, cyclic paths were possible near the water table with GWF models using the NEWTON option. With Newton, dry cells remain active; a flow model may produce numerically insignificant upwards flow through the top face of a partially saturated cell. With DRY\\_TRACKING\\_METHOD DROP (the default option), a particle in a partially saturated cell could obtain an exit solution through the cell's top face, jump to the dry cell above, then drop back down, and so on. In partially saturated cells, any flow upwards through the top face which is not associated with an assigned boundary is now ignored. This prevents particles from exiting through the top face of partially saturated cells unless the top face is an assigned boundary."
@@ -96,4 +96,14 @@ description = "Fixed a memory exception that has occurred when running parallel
9696
[[items]]
9797
section = "fixes"
9898
subsection = "parallel"
99-
description = "Fixed the case where a convergence failure of the PETSc linear solver halts the program with an exception (error -5). This particular failure is now handled by continuing with the next outer iteration. This is equivalent to what happens when using the IMS solver in a serial simulation."
99+
description = "Fixed the case where a convergence failure of the PETSc linear solver halts the program with an exception (error -5). This particular failure is now handled by continuing with the next outer iteration. This is equivalent to what happens when using the IMS solver in a serial simulation."
100+
101+
[[items]]
102+
section = "features"
103+
subsection = "stress"
104+
description = "Added HIGHEST\\_SATURATED option to the GWT SRC package. When activated, the HIGHEST\\_SATURATED option will apply a mass source loading rate to the specified CELLID or the highest underlying cell with a non-zero cell saturation. The HIGHEST\\_SATURATED option has an additional complication for certain types of grids specified using the DISU Package. When the DISU Package is used, a cell may have more than one cell underlying it. If the overlying cell were to become inactive, there is no straightforward method for determining how to apportion the mass source loading rate to the underlying cells. In this case, the approach described by \\cite{modflowusg} is used. The mass source loading rate is assigned to the first active cell encountered (determined by searching through the underlying cell numbers from the lowest number to the highest number). In this manner, the total mass source loading rate is conserved; however, the spatial distribution of the applied mass source loading rate may not be maintained as layers become dry or wet during a simulation."
105+
106+
[[items]]
107+
section = "features"
108+
subsection = "basic"
109+
description = "Added a coordinate reference system option CRS to discretization packages. For example, an EPSG integer code, authority string, or Open Geospatial Consortium Well-Known Text (WKT) specification. This option does not affect simulation results, but is written to the binary grid file so that postprocessors can locate the grid in space. A new binary grid file version number (2) is introduced to indicate that CRS information may be present."

doc/ReleaseNotes/mk_releasenotes.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
parser = argparse.ArgumentParser()
1616
parser.add_argument("--toml", default="develop.toml")
1717
parser.add_argument("--tex", default="develop.tex")
18+
parser.add_argument("--patch", default=False, action="store_true")
1819
args = parser.parse_args()
1920
toml_path = Path(args.toml).expanduser().absolute()
2021
tex_path = Path(args.tex).expanduser().absolute()
22+
patch = args.patch
2123
if not toml_path.is_file():
2224
warn(f"Release notes TOML file not found: {toml_path}")
2325
sys.exit(0)
@@ -45,9 +47,13 @@
4547
with open(tex_path, "w") as tex_file:
4648
with open(toml_path, "rb") as toml_file:
4749
content = tomli.load(toml_file)
48-
sections = content.get("sections", [])
49-
subsections = content.get("subsections", [])
50+
sections = content.get("sections", {})
51+
subsections = content.get("subsections", {})
5052
items = content.get("items", [])
53+
# if patch, only include fixes
54+
if patch:
55+
sections = {k: v for k, v in sections.items() if k == "fixes"}
56+
items = [item for item in items if item.get("section") == "fixes"]
5157
# make sure each item has a subsection entry even if empty
5258
for item in items:
5359
if not item.get("subsection"):

0 commit comments

Comments
 (0)