Skip to content

Commit de7b9f6

Browse files
committed
Fix generation script to use correct path
1 parent 7ee5d22 commit de7b9f6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/generate_code_reference_pages.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@
44

55
import mkdocs_gen_files
66

7-
for file_path in Path("../diffsync").rglob("*.py"):
7+
# Base path to the diffsync package
8+
# When mkdocs runs this script, it runs from the project root
9+
# So we need to reference the diffsync package relative to the project root
10+
base_path = Path("diffsync")
11+
12+
# Directories to exclude from code reference generation
13+
exclude_dirs = {"__pycache__", "static", "tests", "examples", "docs"}
14+
15+
for file_path in base_path.rglob("*.py"):
16+
# Skip files in excluded directories
17+
if any(part in exclude_dirs for part in file_path.parts):
18+
continue
19+
20+
# Ensure the file is actually within the base_path directory
21+
try:
22+
file_path.relative_to(base_path)
23+
except ValueError:
24+
continue
25+
826
module_path = file_path.with_suffix("")
927
doc_path = file_path.with_suffix(".md")
1028
full_doc_path = Path("code-reference", doc_path)

0 commit comments

Comments
 (0)