Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b9a5089
add readmes for input folders and fill out with information in source…
kennedy-mindermann Jul 9, 2026
d0ee7ae
add missing file to readme
kennedy-mindermann Jul 9, 2026
07cf9e9
add script to compile inputs.md from the inputs/*/readme.md files
kennedy-mindermann Jul 13, 2026
05e9a27
update formatting of readmes
kennedy-mindermann Jul 13, 2026
a0ee7bb
update script to not have duplicate headers
kennedy-mindermann Jul 13, 2026
e1341a1
merge main into km/source-documentation
kennedy-mindermann Jul 16, 2026
910841e
update some links and fix spelling errors
kennedy-mindermann Jul 20, 2026
56744b8
update formatting
kennedy-mindermann Jul 20, 2026
e3ac86c
remove input file records from sources.csv, add new dollar year file,…
kennedy-mindermann Jul 22, 2026
d49df6e
update readme
kennedy-mindermann Jul 22, 2026
e768cdf
Merge branch 'main' into km/source-documentation
kennedy-mindermann Jul 22, 2026
c98a334
formatting updates
kennedy-mindermann Jul 22, 2026
c620e35
remove the old generate_markdown script
kennedy-mindermann Jul 24, 2026
a72bf8c
Merge branch 'main' into km/source-documentation
kennedy-mindermann Jul 24, 2026
6340034
delete sources_documentation.md
kennedy-mindermann Jul 24, 2026
09ff17c
add get_source_deflator_map function back into copy_files
kennedy-mindermann Jul 29, 2026
02dce1e
merge main into km/source-documentation
Aug 3, 2026
9dcff00
merge main into km/source-documentation
kennedy-mindermann Aug 19, 2026
c373232
fix copy_files
kennedy-mindermann Aug 20, 2026
09a43f7
Merge branch 'main' into km/source-documentation
kennedy-mindermann Aug 21, 2026
de4c80a
Merge branch 'main' into km/source-documentation
kennedy-mindermann Aug 24, 2026
b32b572
Merge branch 'main' into km/source-documentation
kennedy-mindermann Aug 25, 2026
0c496d3
updates in response to pr comments
kennedy-mindermann Aug 26, 2026
77fe9df
remove get_source_deflator_map
kennedy-mindermann Aug 27, 2026
5414bbe
Merge branch 'main' into km/source-documentation
kennedy-mindermann Aug 27, 2026
6e957b5
Update inputs/canada_imports/README.md
kennedy-mindermann Aug 27, 2026
02b4d5e
Update inputs/canada_imports/README.md
kennedy-mindermann Aug 27, 2026
4f5e0cf
Update inputs/sets/README.md
kennedy-mindermann Aug 27, 2026
7f33332
Update inputs/consume/README.md
kennedy-mindermann Aug 27, 2026
faa0612
Update inputs/canada_imports/README.md
kennedy-mindermann Aug 27, 2026
234cff3
Update inputs/canada_imports/README.md
kennedy-mindermann Aug 27, 2026
1429dae
Merge branch 'main' into km/source-documentation
kennedy-mindermann Aug 27, 2026
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
78 changes: 78 additions & 0 deletions docs/scripts/generate_inputs_markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env python

import argparse
import os
from pathlib import Path

def _collect_input_readmes(inputs_root: Path) -> list[Path]:
readmes = []
for child in sorted(inputs_root.iterdir(), key=lambda p: p.name.casefold()):
if not child.is_dir():
continue
readme = child / "README.md"
if readme.exists():
readmes.append(readme)
return readmes


def _write_inputs_md(output_path: Path, readmes: list[Path]) -> None:
lines = []
lines.append("# Inputs Documentation")
lines.append("")
lines.append(
"This page aggregates documentation from each folder README under the inputs directory."
)
lines.append("")
lines.append("## Table of Contents")
lines.append("")

for readme in readmes:
folder = readme.parent.name
lines.append(f"- [inputs/{folder}](#inputs{folder})")

# Do not add an additional markdown section header here.
# Each included README already contains its own heading.
for readme in readmes:
folder = readme.parent.name
include_rel = os.path.relpath(readme, output_path.parent).replace(os.sep, "/")
lines.append("")
lines.append(f"<a id='inputs{folder}'></a>")
lines.append("")
lines.append("```{include} " + include_rel)
lines.append("```")

output_path.write_text("\n".join(lines) + "\n", encoding="utf-8")


def main(app=None):
# If called from Sphinx, app is provided; otherwise support optional CLI usage.
if app is None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--reedsPath",
"-r",
type=str,
default="",
help="Path to ReEDS repository root",
)
args = parser.parse_args()
if args.reedsPath:
repo_root = Path(args.reedsPath).resolve()
else:
# docs/scripts/generate_inputs_markdown.py -> repo root is two levels up.
repo_root = Path(__file__).resolve().parents[2]
else:
repo_root = Path(app.srcdir).resolve().parents[1]

inputs_root = repo_root / "inputs"
docs_source_root = repo_root / "docs" / "source"
output_path = docs_source_root / "inputs.md"

readmes = _collect_input_readmes(inputs_root)
_write_inputs_md(output_path, readmes)
Comment on lines +71 to +72

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about bringing the function code down to here instead of keeping it above in the functions? That seems slightly more intuitive to me, but maybe there is a value to keeping it as a function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see value in keeping the main function smaller, and having this as a separate function makes it a little more digestible imo. Happy to reconsider if you feel strongly, but I'd lean toward leaving it separate.


print("inputs.md has been updated from inputs/*/README.md files")


if __name__ == "__main__":
main()
257 changes: 0 additions & 257 deletions docs/scripts/generate_markdown.py

This file was deleted.

6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "scripts"))
import generate_markdown
import generate_inputs_markdown

# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -16,9 +16,9 @@
copyright = "2024, NREL"
author = "NLR"

# --setup function to run generate_markdown.py on 'make html' ---------------------------------
# --setup function to run generate_inputs_markdown.py on 'make html' ---------------------------------
def setup(app):
app.connect("builder-inited", generate_markdown.main)
app.connect("builder-inited", generate_inputs_markdown.main)

# -- General configuration ----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/source/developer_best_practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ To edit the ReEDS documentation:
3. Commit and push your changes as you normally would.
- **When your pull request gets merged into main, there is a github action that will automatically recompile the documentation with your changes and publish the updated site.**

Make sure to update the `docs/sources.csv` file when applicable.
If you're updating anything related to the input files, make sure to update the relevant `inputs/*/README.md`.

### Viewing the Documentation Locally

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ setup
developer_best_practices
model_documentation
user_guide
sources
inputs
postprocessing_tools
publications
faq
Expand Down
Loading
Loading