Skip to content

Commit

Permalink
GH-125722: Increase minimum supported Sphinx to 8.1.3 (#128922)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner authored Jan 20, 2025
1 parent bca35f0 commit d46b577
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 96 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,6 @@ jobs:
--fail-if-improved \
--fail-if-new-news-nit
# This build doesn't use problem matchers or check annotations
build_doc_oldest_supported_sphinx:
name: 'Docs (Oldest Sphinx)'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.13' # known to work with Sphinx 7.2.6
cache: 'pip'
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
- name: 'Install build dependencies'
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
- name: 'Build HTML documentation'
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html

# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
doctest:
name: 'Doctest'
Expand Down
24 changes: 3 additions & 21 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import importlib
import os
import sys
import time

import sphinx

# Make our custom extensions available to Sphinx
sys.path.append(os.path.abspath('tools/extensions'))
Expand Down Expand Up @@ -97,7 +94,8 @@
highlight_language = 'python3'

# Minimum version of sphinx required
needs_sphinx = '7.2.6'
# Keep this version in sync with ``Doc/requirements.txt``.
needs_sphinx = '8.1.3'

# Create table of contents entries for domain objects (e.g. functions, classes,
# attributes, etc.). Default is True.
Expand Down Expand Up @@ -376,13 +374,7 @@

# This 'Last updated on:' timestamp is inserted at the bottom of every page.
html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)'
if sphinx.version_info[:2] >= (8, 1):
html_last_updated_use_utc = True
else:
html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
html_last_updated_fmt = time.strftime(
html_last_updated_fmt, time.gmtime(html_time)
)
html_last_updated_use_utc = True

# Path to find HTML templates to override theme
templates_path = ['tools/templates']
Expand Down Expand Up @@ -619,16 +611,6 @@
}
extlinks_detect_hardcoded_links = True

if sphinx.version_info[:2] < (8, 1):
# Sphinx 8.1 has in-built CVE and CWE roles.
extlinks |= {
"cve": (
"https://www.cve.org/CVERecord?id=CVE-%s",
"CVE-%s",
),
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
}

# Options for c_annotations extension
# -----------------------------------

Expand Down
14 changes: 6 additions & 8 deletions Doc/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ packaging<25
Pygments<3
requests<3
snowballstemmer<3
# keep lower-bounds until Sphinx 8.1 is released
# https://github.com/sphinx-doc/sphinx/pull/12756
sphinxcontrib-applehelp>=1.0.7,<3
sphinxcontrib-devhelp>=1.0.6,<3
sphinxcontrib-htmlhelp>=2.0.6,<3
sphinxcontrib-jsmath>=1.0.1,<2
sphinxcontrib-qthelp>=1.0.6,<3
sphinxcontrib-serializinghtml>=1.1.9,<3
sphinxcontrib-applehelp<3
sphinxcontrib-devhelp<3
sphinxcontrib-htmlhelp<3
sphinxcontrib-jsmath<2
sphinxcontrib-qthelp<3
sphinxcontrib-serializinghtml<3

# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
MarkupSafe<3
35 changes: 0 additions & 35 deletions Doc/requirements-oldest-sphinx.txt

This file was deleted.

3 changes: 2 additions & 1 deletion Doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# Note that when updating this file, you will likely also have to update
# the Doc/constraints.txt file.

# Sphinx version is pinned so that new versions that introduce new warnings
# The Sphinx version is pinned so that new versions that introduce new warnings
# won't suddenly cause build failures. Updating the version is fine as long
# as no warnings are raised by doing so.
# Keep this version in sync with ``Doc/conf.py``.
sphinx~=8.1.0

blurb
Expand Down
11 changes: 0 additions & 11 deletions Doc/tools/extensions/c_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from pathlib import Path
from typing import TYPE_CHECKING

import sphinx
from docutils import nodes
from docutils.statemachine import StringList
from sphinx import addnodes
Expand Down Expand Up @@ -285,16 +284,6 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.connect("builder-inited", init_annotations)
app.connect("doctree-read", add_annotations)

if sphinx.version_info[:2] < (7, 2):
from docutils.parsers.rst import directives
from sphinx.domains.c import CObject

# monkey-patch C object...
CObject.option_spec |= {
"no-index-entry": directives.flag,
"no-contents-entry": directives.flag,
}

return {
"version": "1.0",
"parallel_read_safe": True,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Require Sphinx 8.1.3 or later to build the Python documentation. Patch by
Adam Turner.

0 comments on commit d46b577

Please sign in to comment.