Skip to content

Commit 9d00379

Browse files
authored
[3.11] Docs: move sphinx-lint to pre-commit (GH-105750) (#108276)
1 parent d678ee7 commit 9d00379

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

.github/workflows/reusable-docs.yml

-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
cache-dependency-path: 'Doc/requirements.txt'
2727
- name: 'Install build dependencies'
2828
run: make -C Doc/ venv
29-
- name: 'Check documentation'
30-
run: make -C Doc/ check
3129
- name: 'Build HTML documentation'
3230
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
3331
- name: 'Upload'
@@ -37,8 +35,6 @@ jobs:
3735
path: Doc/build/html
3836

3937
# This build doesn't use problem matchers or check annotations
40-
# It also does not run 'make check', as sphinx-lint is not installed into the
41-
# environment.
4238
build_doc_oldest_supported_sphinx:
4339
name: 'Docs (Oldest Sphinx)'
4440
runs-on: ubuntu-latest

.pre-commit-config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ repos:
55
- id: check-yaml
66
- id: trailing-whitespace
77
types_or: [c, python, rst]
8+
9+
- repo: https://github.com/sphinx-contrib/sphinx-lint
10+
rev: v0.6.8
11+
hooks:
12+
- id: sphinx-lint
13+
args: [--enable=default-role]
14+
files: ^Doc/|^Misc/NEWS.d/next/
15+
types: [rst]

Doc/Makefile

+3-5
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,9 @@ dist:
214214
rm -r dist/python-$(DISTVERSION)-docs-texinfo
215215
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
216216

217-
check:
218-
# Check the docs and NEWS files with sphinx-lint.
219-
# Ignore the tools and venv dirs and check that the default role is not used.
220-
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
221-
$(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
217+
check: venv
218+
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
219+
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
222220

223221
serve:
224222
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"

Doc/constraints.txt

-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,3 @@ sphinxcontrib-serializinghtml<1.2
2323

2424
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
2525
MarkupSafe<2.2
26-
27-
# Direct dependencies of sphinx-lint
28-
polib<1.3
29-
regex<2024

Doc/requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ sphinx==4.5.0
1010

1111
blurb
1212

13-
sphinx-lint==0.6.7
1413
sphinxext-opengraph>=0.7.1
1514

1615
# The theme used by the documentation is stored separately, so we need

0 commit comments

Comments
 (0)