fix(docs): install the Read the Docs build with uv from uv.lock

.readthedocs.yaml installed requirements-dev.txt, which #896 removed.
Every Read the Docs build since 2026-02-23 failed with "Could not open
requirements file", so the published documentation stayed at 0.2.0.
Read the Docs now runs uv sync with the dev extra, which holds the
Sphinx packages, and takes the versions from uv.lock like CI.

Additional changes
Build the documentation with Python 3.13 like CI, pre-commit and Docker
Test that every file, path and extra in .readthedocs.yaml exists

Fixes #1561

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
Christin
2026-11-20 21:42:15 +01:00
committed by Bobby Noelte
co-authored by Claude Opus 5.5
parent 3035ec0a4b
commit 966fc7ba7f
2 changed files with 45 additions and 2 deletions
+6 -2
View File
@@ -3,11 +3,15 @@ version: 2
build: build:
os: ubuntu-24.04 os: ubuntu-24.04
tools: tools:
python: "3.12" python: "3.13"
sphinx: sphinx:
configuration: docs/conf.py configuration: docs/conf.py
python: python:
install: install:
- requirements: requirements-dev.txt # uv sync installs EOS with the Sphinx packages of the dev extra in the versions of uv.lock.
- method: uv
command: sync
extras:
- dev
+39
View File
@@ -5,11 +5,13 @@ import shutil
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import tomllib
from pathlib import Path from pathlib import Path
from types import ModuleType, SimpleNamespace from types import ModuleType, SimpleNamespace
from typing import TYPE_CHECKING, Any, Optional, cast from typing import TYPE_CHECKING, Any, Optional, cast
import pytest import pytest
import yaml
from akkudoktoreos.core.coreabc import singletons_init from akkudoktoreos.core.coreabc import singletons_init
@@ -24,6 +26,7 @@ DIR_DOCS = DIR_PROJECT_ROOT / "docs"
DIR_SRC = DIR_PROJECT_ROOT / "src" DIR_SRC = DIR_PROJECT_ROOT / "src"
HASH_FILE = DIR_BUILD / ".sphinx_hash.json" HASH_FILE = DIR_BUILD / ".sphinx_hash.json"
READTHEDOCS_CONFIG = DIR_PROJECT_ROOT / ".readthedocs.yaml"
# Parallel jobs of the Sphinx build. Sphinx reads the sources and writes the pages in several # Parallel jobs of the Sphinx build. Sphinx reads the sources and writes the pages in several
# processes; resolving the cross-references stays in the main process. With the EOS API # processes; resolving the cross-references stays in the main process. With the EOS API
@@ -203,6 +206,42 @@ class TestSphinxDocumentation:
HASH_FILE.write_text(json.dumps({"hash": sphinx_changed}, indent=2)) HASH_FILE.write_text(json.dumps({"hash": sphinx_changed}, indent=2))
class TestReadTheDocsConfig:
"""Verify the Read the Docs configuration in .readthedocs.yaml.
Read the Docs builds the published documentation with its own install steps. CI builds
the documentation in the development environment, so it does not notice when these
steps refer to something the repository no longer has.
"""
def test_references_exist(self) -> None:
"""Every file, path and extra the Read the Docs build refers to exists."""
config = yaml.safe_load(READTHEDOCS_CONFIG.read_text(encoding="utf-8"))
pyproject = tomllib.loads((DIR_PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
defined_extras = set(pyproject["project"]["optional-dependencies"])
missing: list[str] = []
sphinx_config = config["sphinx"]["configuration"]
if not (DIR_PROJECT_ROOT / sphinx_config).is_file():
missing.append(f"sphinx.configuration '{sphinx_config}'")
for install in config["python"]["install"]:
requirements = install.get("requirements")
if requirements is not None and not (DIR_PROJECT_ROOT / requirements).is_file():
missing.append(f"python.install requirements '{requirements}'")
path = install.get("path", ".")
if not (DIR_PROJECT_ROOT / path).is_dir():
missing.append(f"python.install path '{path}'")
extras = install.get("extras", install.get("extra_requirements", []))
if extras != "all":
missing.extend(
f"python.install extra '{extra}'"
for extra in extras
if extra not in defined_extras
)
assert not missing, f"{READTHEDOCS_CONFIG.name} refers to missing items: {missing}"
# --- Local Sphinx extension docs/_ext/pyxrefindex.py -------------------------------- # --- Local Sphinx extension docs/_ext/pyxrefindex.py --------------------------------
PYXREFINDEX_FILE = DIR_DOCS / "_ext" / "pyxrefindex.py" PYXREFINDEX_FILE = DIR_DOCS / "_ext" / "pyxrefindex.py"