Skip to content

Commit d46b577

Browse files
authored
pythonGH-125722: Increase minimum supported Sphinx to 8.1.3 (python#128922)
1 parent bca35f0 commit d46b577

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
@@ -76,26 +76,6 @@ jobs:
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
7878
79-
# This build doesn't use problem matchers or check annotations
80-
build_doc_oldest_supported_sphinx:
81-
name: 'Docs (Oldest Sphinx)'
82-
runs-on: ubuntu-latest
83-
timeout-minutes: 60
84-
steps:
85-
- uses: actions/checkout@v4
86-
with:
87-
persist-credentials: false
88-
- name: 'Set up Python'
89-
uses: actions/setup-python@v5
90-
with:
91-
python-version: '3.13' # known to work with Sphinx 7.2.6
92-
cache: 'pip'
93-
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
94-
- name: 'Install build dependencies'
95-
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
96-
- name: 'Build HTML documentation'
97-
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
98-
9979
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
10080
doctest:
10181
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'))
@@ -97,7 +94,8 @@
9794
highlight_language = 'python3'
9895

9996
# Minimum version of sphinx required
100-
needs_sphinx = '7.2.6'
97+
# Keep this version in sync with ``Doc/requirements.txt``.
98+
needs_sphinx = '8.1.3'
10199

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

377375
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
378376
html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)'
379-
if sphinx.version_info[:2] >= (8, 1):
380-
html_last_updated_use_utc = True
381-
else:
382-
html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
383-
html_last_updated_fmt = time.strftime(
384-
html_last_updated_fmt, time.gmtime(html_time)
385-
)
377+
html_last_updated_use_utc = True
386378

387379
# Path to find HTML templates to override theme
388380
templates_path = ['tools/templates']
@@ -619,16 +611,6 @@
619611
}
620612
extlinks_detect_hardcoded_links = True
621613

622-
if sphinx.version_info[:2] < (8, 1):
623-
# Sphinx 8.1 has in-built CVE and CWE roles.
624-
extlinks |= {
625-
"cve": (
626-
"https://www.cve.org/CVERecord?id=CVE-%s",
627-
"CVE-%s",
628-
),
629-
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
630-
}
631-
632614
# Options for c_annotations extension
633615
# -----------------------------------
634616

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)