Skip to content

Commit

Permalink
chore(release): generate release notes latex file from toml
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 17, 2024
1 parent 11b98f2 commit 306408f
Show file tree
Hide file tree
Showing 8 changed files with 24,649 additions and 23,026 deletions.
100 changes: 0 additions & 100 deletions doc/ReleaseNotes/develop.tex

This file was deleted.

10 changes: 10 additions & 0 deletions doc/ReleaseNotes/develop.tex.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\item \currentmodflowversion

{% for section, notes in sections|groupby("type") %}
\underline{{{ section }}}
\begin{itemize}
{% for note in section %}
\item {{ note.text }}
{% endfor %}
\end{itemize}
{% endfor %}
197 changes: 197 additions & 0 deletions doc/ReleaseNotes/develop.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/ReleaseNotes/mk_deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
ftex.close()
print(f"Created LaTex file {fnametex} from markdown deprecations file {fpath}")
else:
warn(f"Deprecations not found: {fpath}")
warn(f"Deprecations file not found: {fpath}")
36 changes: 36 additions & 0 deletions doc/ReleaseNotes/mk_releasenotes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This script converts the release notes TOML file
# to a latex file to include in the release notes.
import argparse
from pathlib import Path
import sys
from warnings import warn


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("path")
args = parser.parse_args()

fname = "develop"
fpath = Path(args.path).expanduser().absolute()
fnametex = Path(f"{fname}.tex").absolute()
fnametex.unlink(missing_ok=True)

if not fpath.is_file():
warn(f"Release notes TOML file not found: {fpath}")
sys.exit(0)

from jinja2 import Environment, FileSystemLoader
import tomlkit

loader = FileSystemLoader(fnametex.parent)
env = Environment(
loader=loader,
trim_blocks=True,
lstrip_blocks=True,
line_statement_prefix="_",
keep_trailing_newline=True,
)
template = env.get_template(f"{fnametex.name}.jinja")
with open(fnametex, "w") as f:
f.write(template.render(tomlkit.load(f"{fname}.toml")))
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
- fprettify
- fortran-language-server
- gitpython
- Jinja2>=3
- jupytext
- matplotlib
- meson=1.3.0
Expand All @@ -39,4 +40,5 @@ dependencies:
- scipy
- shapely
- syrupy
- tomlkit

47,326 changes: 24,401 additions & 22,925 deletions pixi.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ flaky = "*"
fortran-language-server = "*"
fprettify = "*"
gitpython = "*"
Jinja2 = ">=3"
jupytext = "*"
matplotlib = "*"
meson = "1.3.0"
Expand All @@ -36,6 +37,7 @@ ruff = "*"
scipy = "*"
shapely = "*"
syrupy = "*"
tomlkit = "*"
xmipy = "*"

[feature.rtd.dependencies]
Expand Down

0 comments on commit 306408f

Please sign in to comment.