Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions yardang/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,19 @@ def customize(args):
fp.write("docs/html\n")
if not has_index_md:
fp.write("index.md\n")
# yield folder path to sphinx build
yield td
# sphinx-llm starts a nested Sphinx build without forwarding the
# generated configuration directory. Make the same configuration
# available from the source directory for that build.
source_configuration = Path("conf.py")
if use_llms:
source_configuration.write_text(template)

try:
# yield folder path to sphinx build
yield td
finally:
if use_llms:
source_configuration.unlink(missing_ok=True)


@contextmanager
Expand Down
2 changes: 2 additions & 0 deletions yardang/conf.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ exclude_patterns = [
".DS_Store",
"node_modules",
"_skbuild",
".venv",
".venv/*",
".pytest_cache",
".github",
".github/*",
Expand Down
1 change: 1 addition & 0 deletions yardang/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def test_default_excludes_cover_generated_and_repo_docs(self, tmp_path):
conf_content = (Path(conf_dir) / "conf.py").read_text()
assert '"README.md"' in conf_content
assert '"AGENTS.md"' in conf_content
assert '".venv"' in conf_content
assert '"docs/.jupyter_cache"' in conf_content
assert '"docs/html"' in conf_content
finally:
Expand Down
3 changes: 3 additions & 0 deletions yardang/tests/test_llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def test_generate_docs_with_llms_enabled(self, tmp_path):
assert "llms_txt_suffix_mode" in conf_content
assert "replace" in conf_content
assert "A project for LLMs" in conf_content
assert Path("conf.py").read_text() == conf_content

assert not Path("conf.py").exists()
finally:
os.chdir(original_cwd)

Expand Down
Loading