mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-25 15:06:20 +01:00
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:
committed by
Bobby Noelte
co-authored by
Claude Opus 5.5
parent
3035ec0a4b
commit
966fc7ba7f
@@ -5,11 +5,13 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
from types import ModuleType, SimpleNamespace
|
||||
from typing import TYPE_CHECKING, Any, Optional, cast
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from akkudoktoreos.core.coreabc import singletons_init
|
||||
|
||||
@@ -24,6 +26,7 @@ DIR_DOCS = DIR_PROJECT_ROOT / "docs"
|
||||
DIR_SRC = DIR_PROJECT_ROOT / "src"
|
||||
|
||||
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
|
||||
# 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))
|
||||
|
||||
|
||||
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 --------------------------------
|
||||
|
||||
PYXREFINDEX_FILE = DIR_DOCS / "_ext" / "pyxrefindex.py"
|
||||
|
||||
Reference in New Issue
Block a user