Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
python -m pip install --upgrade pip

- name: Render PEPs
run: make dirhtml JOBS=$(nproc)
run: make dirhtml pagefind JOBS=$(nproc)

# remove the .doctrees folder when building for deployment as it takes two thirds of disk space
- name: Clean up files
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html
- make dirhtml pagefind JOBS=$(nproc) BUILDDIR=_readthedocs/html

sphinx:
builder: dirhtml
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ ALLSPHINXOPTS = --builder $(BUILDER) \
.PHONY: html
html: venv
$(SPHINXBUILD) $(ALLSPHINXOPTS)
$(VENVDIR)/bin/python3 -m pagefind --site $(BUILDDIR) --verbose

## htmlview to open the index page built by the html target in your browser
.PHONY: htmlview
Expand All @@ -43,6 +42,11 @@ dirhtml: BUILDER = dirhtml
dirhtml: html
mv $(BUILDDIR)/404/index.html $(BUILDDIR)/404.html

## pagefind to rebuild the search index
.PHONY: pagefind
pagefind: venv
$(VENVDIR)/bin/python3 -m pagefind --site $(BUILDDIR) --verbose

## linkcheck to check validity of links within PEP sources
.PHONY: linkcheck
linkcheck: BUILDER = linkcheck
Expand Down
16 changes: 11 additions & 5 deletions pep_sphinx_extensions/pep_zero_generator/subindices.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@

def update_sphinx(filename: str, text: str, docnames: list[str], env: BuildEnvironment) -> Path:
file_path = Path(env.srcdir, f"{filename}.rst")
file_path.write_text(text, encoding="utf-8")

# Add to files for builder
docnames.append(filename)
# Add to files for writer
# Only write and schedule for rebuild if content actually changed
try:
current = file_path.read_text(encoding="utf-8")
except FileNotFoundError:
current = None
if current != text:
file_path.write_text(text, encoding="utf-8")
if filename not in docnames:
docnames.append(filename)

# Always ensure Sphinx knows about the file
env.found_docs.add(filename)

return file_path
Expand Down
3 changes: 3 additions & 0 deletions peps/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"api/*.rst",
# Documentation
"docs/*.rst",
# Generated index files
"numerical.rst",
"topic/*.rst",
]
# And to ignore when looking for source files.
exclude_patterns = [
Expand Down
Loading