Skip to content

Commit 2085e95

Browse files
Generate readthedocs pages for the experimental examples group (mesa#3788)
`setup_examples_pages()` only scanned `basic/` and `advanced/`, so moving alliance_formation into `mesa/examples/experimental/` dropped it from the docs entirely. Drive the scan and the output-directory creation from a single `kinds` tuple so the new group is picked up. Also fix a typo in .gitignore: the generated overview page is `docs/examples.md`, not `docs/example.md`, so it was showing up as untracked after every doc build. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d7346ed commit 2085e95

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ benchmarks/**/*.pickle
33

44
# exampledocs
55
docs/examples/*
6-
docs/example.md
6+
docs/examples.md
77

88
# Byte-compiled / optimized / DLL files
99
__pycache__/

docs/conf.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,27 +323,21 @@ def setup_examples_pages():
323323
# create md files for all examples
324324
# check what examples exist
325325
examples_folder = osp.abspath(osp.join(HERE, "..", "mesa", "examples"))
326-
basic_examples = [
327-
("basic", f.path)
328-
for f in os.scandir(osp.join(examples_folder, "basic"))
326+
kinds = ("basic", "advanced", "experimental")
327+
examples = [
328+
(kind, f.path)
329+
for kind in kinds
330+
for f in os.scandir(osp.join(examples_folder, kind))
329331
if f.is_dir() and not f.name.startswith("__")
330332
]
331-
advanced_examples = [
332-
("advanced", f.path)
333-
for f in os.scandir(osp.join(examples_folder, "advanced"))
334-
if f.is_dir() and not f.name.startswith("__")
335-
]
336-
examples = basic_examples + advanced_examples
337333

338334
with open(os.path.join(HERE, "example_template.txt")) as fh:
339335
template = string.Template(fh.read())
340336

341337
root_folder = pathlib.Path(os.path.join(HERE, "examples"))
342338
root_folder.mkdir(parents=True, exist_ok=True)
343-
pathlib.Path(os.path.join(root_folder, "basic")).mkdir(parents=True, exist_ok=True)
344-
pathlib.Path(os.path.join(root_folder, "advanced")).mkdir(
345-
parents=True, exist_ok=True
346-
)
339+
for kind in kinds:
340+
pathlib.Path(os.path.join(root_folder, kind)).mkdir(parents=True, exist_ok=True)
347341

348342
examples_md = []
349343
for kind, example in examples:

0 commit comments

Comments
 (0)