Skip to content

Commit 4978c23

Browse files
committed
docs: use generated API overview pages
1 parent 8150007 commit 4978c23

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ generate-fern-api-reference:
510510
$(DOCS_PY2FERN) write $(FERN_API_REFERENCE_ENGINE_MCP_SOURCE) --module data_designer.engine.mcp --output $(FERN_API_REFERENCE_OUTPUT)/engine/mcp --clean
511511
$(DOCS_PY2FERN) write $(FERN_API_REFERENCE_ENGINE_PROCESSORS_SOURCE) --module data_designer.engine.processing.processors --output $(FERN_API_REFERENCE_OUTPUT)/engine/processors --clean
512512
$(DOCS_PY2FERN) write $(FERN_API_REFERENCE_ENGINE_SEED_READERS_SOURCE) --module data_designer.engine.resources.seed_reader --output $(FERN_API_REFERENCE_OUTPUT)/engine/seed-readers --clean
513+
$(DOCS_PYTHON) fern/scripts/normalize-py2fern-indexes.py $(FERN_API_REFERENCE_OUTPUT)
513514

514515
generate-fern-api-reference-native:
515516
@echo "📚 Generating Fern API reference with Fern CLI..."
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python3
2+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
"""Convert py2fern self-named module pages into Fern folder overview pages."""
6+
7+
from __future__ import annotations
8+
9+
import argparse
10+
import re
11+
from pathlib import Path
12+
13+
14+
def normalized(value: str) -> str:
15+
return re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
16+
17+
18+
def normalize_root(root: Path) -> int:
19+
renamed = 0
20+
for path in sorted(root.rglob("*.mdx")):
21+
if path.name == "index.mdx":
22+
continue
23+
if normalized(path.stem) != normalized(path.parent.name):
24+
continue
25+
26+
target = path.with_name("index.mdx")
27+
if target.exists():
28+
raise FileExistsError(f"Cannot rename {path}: {target} already exists")
29+
path.rename(target)
30+
renamed += 1
31+
return renamed
32+
33+
34+
def main() -> int:
35+
parser = argparse.ArgumentParser(description=__doc__)
36+
parser.add_argument("roots", nargs="+", type=Path, help="py2fern output roots to normalize")
37+
args = parser.parse_args()
38+
39+
count = 0
40+
for root in args.roots:
41+
if not root.exists():
42+
raise FileNotFoundError(root)
43+
count += normalize_root(root)
44+
print(f"Normalized {count} py2fern pages to index.mdx")
45+
return 0
46+
47+
48+
if __name__ == "__main__":
49+
raise SystemExit(main())

0 commit comments

Comments
 (0)