Skip to content

Commit 23311b7

Browse files
Copilotxadupre
andauthored
Remove "5 Longest Pages to Generate" documentation page (#2170)
* Initial plan * remove page 5 Longest Pages to Generate Agent-Logs-Url: https://github.com/xadupre/yet-another-onnx-builder/sessions/5475a79a-084f-49c0-b3e1-1112d4cac12b Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
1 parent 33e1587 commit 23311b7

3 files changed

Lines changed: 1 addition & 107 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,14 @@
1-
import json
21
import logging
32
import os
43
import shutil
54
import sys
6-
import time
75
from sphinx_runpython.github_link import make_linkcode_resolve
86
import yobx
97

108
# Suppress TensorFlow C++ and Python logging before any TF import occurs.
119
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
1210
logging.getLogger("tensorflow").setLevel(logging.ERROR)
1311

14-
# ---------------------------------------------------------------------------
15-
# Per-page build duration tracking (writes top-5 to a JSON file so that the
16-
# doc_build_durations.rst page can display it in the generated documentation).
17-
# ---------------------------------------------------------------------------
18-
19-
_PAGE_TIMINGS_START: dict[str, float] = {}
20-
_PAGE_DURATIONS: dict[str, float] = {}
21-
_DOC_BUILD_DURATIONS_JSON = os.path.join(
22-
os.path.dirname(__file__), "_static", "doc_build_durations.json"
23-
)
24-
os.environ["YOBX_DOC_BUILD_DURATIONS_JSON"] = _DOC_BUILD_DURATIONS_JSON
25-
26-
27-
def _on_source_read(app, docname, source):
28-
"""Records the start time when a source file begins to be read."""
29-
_PAGE_TIMINGS_START[docname] = time.monotonic()
30-
31-
32-
def _on_doctree_read(app, doctree):
33-
"""Records the elapsed time after a doctree has been parsed."""
34-
docname = app.env.docname
35-
start = _PAGE_TIMINGS_START.pop(docname, None)
36-
if start is not None:
37-
_PAGE_DURATIONS[docname] = time.monotonic() - start
38-
39-
40-
def _on_build_finished(app, exception):
41-
"""Writes the 5 slowest pages (by build duration) to a JSON file."""
42-
if exception or not _PAGE_DURATIONS:
43-
return
44-
top5 = sorted(_PAGE_DURATIONS.items(), key=lambda kv: kv[1], reverse=True)[:5]
45-
static_dir = os.path.dirname(_DOC_BUILD_DURATIONS_JSON)
46-
if os.path.exists(static_dir) and not os.path.isdir(static_dir):
47-
os.remove(static_dir)
48-
os.makedirs(static_dir, exist_ok=True)
49-
with open(_DOC_BUILD_DURATIONS_JSON, "w", encoding="utf-8") as fh:
50-
json.dump(
51-
[{"docname": name, "duration_s": round(dur, 3)} for name, dur in top5], fh, indent=2
52-
)
53-
5412

5513
def _on_builder_inited(app):
5614
"""Removes any non-directory file named '_static' in the output directory.
@@ -66,11 +24,8 @@ def _on_builder_inited(app):
6624

6725

6826
def setup(app):
69-
"""Connects duration-tracking hooks to Sphinx events."""
27+
"""Connects hooks to Sphinx events."""
7028
app.connect("builder-inited", _on_builder_inited)
71-
app.connect("source-read", _on_source_read)
72-
app.connect("doctree-read", _on_doctree_read)
73-
app.connect("build-finished", _on_build_finished)
7429

7530

7631
project = "yet-another-onnx-builder"

docs/doc_build_durations.rst

Lines changed: 0 additions & 60 deletions
This file was deleted.

docs/misc.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Additional statistics and metadata about the documentation build.
1111
index_stats
1212
ci_durations
1313
commits_per_week
14-
doc_build_durations
1514
comparison
1615
weekly_progress
1716
pypi_downloads

0 commit comments

Comments
 (0)