Skip to content

Commit 51fbfde

Browse files
AA-Turnermiss-islington
authored andcommitted
pythonGH-125722: Increase minimum supported Sphinx to 8.1.3 (pythonGH-128922)
(cherry picked from commit d46b577) Co-authored-by: Adam Turner <[email protected]>
1 parent 22c1d89 commit 51fbfde

File tree

7 files changed

+13
-96
lines changed

7 files changed

+13
-96
lines changed

.github/workflows/reusable-docs.yml

-20
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,6 @@ jobs:
7373
--fail-if-improved \
7474
--fail-if-new-news-nit
7575
76-
# This build doesn't use problem matchers or check annotations
77-
build_doc_oldest_supported_sphinx:
78-
name: 'Docs (Oldest Sphinx)'
79-
runs-on: ubuntu-latest
80-
timeout-minutes: 60
81-
steps:
82-
- uses: actions/checkout@v4
83-
with:
84-
persist-credentials: false
85-
- name: 'Set up Python'
86-
uses: actions/setup-python@v5
87-
with:
88-
python-version: '3.13' # known to work with Sphinx 7.2.6
89-
cache: 'pip'
90-
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
91-
- name: 'Install build dependencies'
92-
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
93-
- name: 'Build HTML documentation'
94-
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
95-
9676
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
9777
doctest:
9878
name: 'Doctest'

Doc/conf.py

+3-21
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import importlib
1010
import os
1111
import sys
12-
import time
13-
14-
import sphinx
1512

1613
# Make our custom extensions available to Sphinx
1714
sys.path.append(os.path.abspath('tools/extensions'))
@@ -85,7 +82,8 @@
8582
highlight_language = 'python3'
8683

8784
# Minimum version of sphinx required
88-
needs_sphinx = '7.2.6'
85+
# Keep this version in sync with ``Doc/requirements.txt``.
86+
needs_sphinx = '8.1.3'
8987

9088
# Create table of contents entries for domain objects (e.g. functions, classes,
9189
# attributes, etc.). Default is True.
@@ -350,13 +348,7 @@
350348

351349
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
352350
html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)'
353-
if sphinx.version_info[:2] >= (8, 1):
354-
html_last_updated_use_utc = True
355-
else:
356-
html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
357-
html_last_updated_fmt = time.strftime(
358-
html_last_updated_fmt, time.gmtime(html_time)
359-
)
351+
html_last_updated_use_utc = True
360352

361353
# Path to find HTML templates to override theme
362354
templates_path = ['tools/templates']
@@ -594,16 +586,6 @@
594586
}
595587
extlinks_detect_hardcoded_links = True
596588

597-
if sphinx.version_info[:2] < (8, 1):
598-
# Sphinx 8.1 has in-built CVE and CWE roles.
599-
extlinks |= {
600-
"cve": (
601-
"https://www.cve.org/CVERecord?id=CVE-%s",
602-
"CVE-%s",
603-
),
604-
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
605-
}
606-
607589
# Options for c_annotations extension
608590
# -----------------------------------
609591

Doc/constraints.txt

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ packaging<25
1313
Pygments<3
1414
requests<3
1515
snowballstemmer<3
16-
# keep lower-bounds until Sphinx 8.1 is released
17-
# https://github.com/sphinx-doc/sphinx/pull/12756
18-
sphinxcontrib-applehelp>=1.0.7,<3
19-
sphinxcontrib-devhelp>=1.0.6,<3
20-
sphinxcontrib-htmlhelp>=2.0.6,<3
21-
sphinxcontrib-jsmath>=1.0.1,<2
22-
sphinxcontrib-qthelp>=1.0.6,<3
23-
sphinxcontrib-serializinghtml>=1.1.9,<3
16+
sphinxcontrib-applehelp<3
17+
sphinxcontrib-devhelp<3
18+
sphinxcontrib-htmlhelp<3
19+
sphinxcontrib-jsmath<2
20+
sphinxcontrib-qthelp<3
21+
sphinxcontrib-serializinghtml<3
2422

2523
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
2624
MarkupSafe<3

Doc/requirements-oldest-sphinx.txt

-35
This file was deleted.

Doc/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# Note that when updating this file, you will likely also have to update
44
# the Doc/constraints.txt file.
55

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

1112
blurb

Doc/tools/extensions/c_annotations.py

-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from pathlib import Path
1717
from typing import TYPE_CHECKING
1818

19-
import sphinx
2019
from docutils import nodes
2120
from docutils.statemachine import StringList
2221
from sphinx import addnodes
@@ -285,16 +284,6 @@ def setup(app: Sphinx) -> ExtensionMetadata:
285284
app.connect("builder-inited", init_annotations)
286285
app.connect("doctree-read", add_annotations)
287286

288-
if sphinx.version_info[:2] < (7, 2):
289-
from docutils.parsers.rst import directives
290-
from sphinx.domains.c import CObject
291-
292-
# monkey-patch C object...
293-
CObject.option_spec |= {
294-
"no-index-entry": directives.flag,
295-
"no-contents-entry": directives.flag,
296-
}
297-
298287
return {
299288
"version": "1.0",
300289
"parallel_read_safe": True,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Require Sphinx 8.1.3 or later to build the Python documentation. Patch by
2+
Adam Turner.

0 commit comments

Comments
 (0)