Skip to content

Commit a712174

Browse files
Merge pull request #46 from richardkoehler/docs/update-docs
Update documentation build
2 parents 5fc0705 + 329c332 commit a712174

7 files changed

Lines changed: 373 additions & 228 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,48 @@ jobs:
128128
run: |
129129
uv run pytest --cov-fail-under=48
130130
131+
docs:
132+
name: Docs (build + linkcheck)
133+
runs-on: ubuntu-latest
134+
135+
steps:
136+
- name: Checkout repository
137+
uses: actions/checkout@v6
138+
139+
- name: Set up uv
140+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
141+
with:
142+
python-version: "3.12"
143+
enable-cache: true
144+
145+
- name: Sync docs dependency group
146+
run: |
147+
uv sync --locked --group docs --no-dev
148+
149+
- name: Build HTML docs (warnings are errors)
150+
run: |
151+
uv run sphinx-build -b html -W --keep-going docs docs/_build/html
152+
153+
- name: Link check (non-blocking)
154+
continue-on-error: true
155+
run: |
156+
uv run sphinx-build -b linkcheck docs docs/_build/linkcheck
157+
158+
- name: Upload rendered HTML artifact
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: docs-html-${{ github.sha }}
162+
path: docs/_build/html
163+
if-no-files-found: error
164+
165+
- name: Upload linkcheck report
166+
if: always()
167+
uses: actions/upload-artifact@v4
168+
with:
169+
name: docs-linkcheck-${{ github.sha }}
170+
path: docs/_build/linkcheck
171+
if-no-files-found: warn
172+
131173
package-briefcase-zip:
132174
name: Package Briefcase ZIP (Windows)
133175
runs-on: windows-latest

.readthedocs.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.11"
6+
python: "3.12"
77
jobs:
88
pre_install:
99
- python -m pip install --upgrade pip
1010
- python -m pip install uv
1111
install:
12-
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv pip install -r docs/requirements.txt
13-
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv pip install .
12+
# Install the project plus the "docs" dependency group (pyproject.toml
13+
# -> [dependency-groups].docs) into the RTD-managed virtualenv, honoring
14+
# uv.lock for reproducibility. No dev/build groups are needed to render docs.
15+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --group docs --no-dev
1416

1517
sphinx:
1618
configuration: docs/conf.py
17-
fail_on_warning: false
19+
# Treat Sphinx warnings as errors. Known harmless warnings are suppressed
20+
# via `suppress_warnings` in docs/conf.py rather than relaxed here.
21+
fail_on_warning: true

docs/conf.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,28 @@
88
project = "Clinical DBS Annotator"
99
author = "Lucia Poma"
1010
release = metadata.version(_DIST_NAME)
11+
version = ".".join(release.split(".")[:2])
1112
copyright = f"2025-{datetime.now().year}, {author}"
1213

1314
extensions = [
1415
"sphinx.ext.autodoc",
1516
"sphinx.ext.napoleon",
1617
"sphinx.ext.viewcode",
18+
"sphinx.ext.intersphinx",
19+
"sphinx_copybutton",
1720
]
1821

1922
templates_path = ["_templates"]
2023
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
2124

25+
# Known, non-actionable warnings that would otherwise fail `-W` builds.
26+
# `image.not_readable` covers screenshots under docs/_static/ that are
27+
# re-generated from the running app and not committed to git (tracked in
28+
# the documentation strategy, P3: screenshot pipeline).
29+
suppress_warnings = [
30+
"image.not_readable",
31+
]
32+
2233
html_theme = "sphinx_rtd_theme"
2334
html_static_path = ["_static"]
2435

@@ -30,3 +41,14 @@
3041
"sticky_navigation": True,
3142
"navigation_depth": 3,
3243
}
44+
45+
intersphinx_mapping = {
46+
"python": ("https://docs.python.org/3", None),
47+
}
48+
49+
# `linkcheck` tuning: timeout aggressive, retry transient failures, and ignore
50+
# anchor-only link failures on sites that rewrite fragments (common on GitHub).
51+
linkcheck_timeout = 15
52+
linkcheck_retries = 2
53+
linkcheck_anchors = False
54+
linkcheck_ignore: list[str] = []

0 commit comments

Comments
 (0)