summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2023-06-18 11:52:05 (GMT)
committerGitHub <noreply@github.com>2023-06-18 11:52:05 (GMT)
commitbc07c8f096791d678ca5c1e3486cb9648f7a027b (patch)
tree59a38aad3d156715b8746dff7a6460846b236a3d
parentdba72175116373c1d15e25d84c88b516daf9f5c4 (diff)
downloadcpython-bc07c8f096791d678ca5c1e3486cb9648f7a027b.zip
cpython-bc07c8f096791d678ca5c1e3486cb9648f7a027b.tar.gz
cpython-bc07c8f096791d678ca5c1e3486cb9648f7a027b.tar.bz2
Docs: move sphinx-lint to pre-commit (#105750)
-rw-r--r--.github/workflows/reusable-docs.yml4
-rw-r--r--.pre-commit-config.yaml8
-rw-r--r--Doc/Makefile8
-rw-r--r--Doc/constraints.txt4
-rw-r--r--Doc/requirements.txt1
5 files changed, 11 insertions, 14 deletions
diff --git a/.github/workflows/reusable-docs.yml b/.github/workflows/reusable-docs.yml
index 8a271e8..c5a15a1 100644
--- a/.github/workflows/reusable-docs.yml
+++ b/.github/workflows/reusable-docs.yml
@@ -28,8 +28,6 @@ jobs:
cache-dependency-path: 'Doc/requirements.txt'
- name: 'Install build dependencies'
run: make -C Doc/ venv
- - name: 'Check documentation'
- run: make -C Doc/ check
- name: 'Build HTML documentation'
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
@@ -59,8 +57,6 @@ jobs:
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
# This build doesn't use problem matchers or check annotations
- # It also does not run 'make check', as sphinx-lint is not installed into the
- # environment.
build_doc_oldest_supported_sphinx:
name: 'Docs (Oldest Sphinx)'
runs-on: ubuntu-latest
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 808622f..464bcde 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -5,3 +5,11 @@ repos:
- id: check-yaml
- id: trailing-whitespace
types_or: [c, python, rst]
+
+ - repo: https://github.com/sphinx-contrib/sphinx-lint
+ rev: v0.6.7
+ hooks:
+ - id: sphinx-lint
+ args: [--enable=default-role]
+ files: ^Doc/
+ types: [rst]
diff --git a/Doc/Makefile b/Doc/Makefile
index c11ea6c..2269189 100644
--- a/Doc/Makefile
+++ b/Doc/Makefile
@@ -216,11 +216,9 @@ dist:
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
.PHONY: check
-check:
- # Check the docs and NEWS files with sphinx-lint.
- # Ignore the tools and venv dirs and check that the default role is not used.
- $(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
- $(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
+check: venv
+ $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
+ $(VENVDIR)/bin/python3 -m pre_commit run --all-files
.PHONY: serve
serve:
diff --git a/Doc/constraints.txt b/Doc/constraints.txt
index 66c748e..54888ea 100644
--- a/Doc/constraints.txt
+++ b/Doc/constraints.txt
@@ -23,7 +23,3 @@ sphinxcontrib-serializinghtml<1.2
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
MarkupSafe<2.2
-
-# Direct dependencies of sphinx-lint
-polib<1.3
-regex<2024
diff --git a/Doc/requirements.txt b/Doc/requirements.txt
index d3fa6ce..bde509f 100644
--- a/Doc/requirements.txt
+++ b/Doc/requirements.txt
@@ -11,7 +11,6 @@ sphinx==6.2.0
blurb
-sphinx-lint==0.6.7
sphinxext-opengraph==0.7.5
# The theme used by the documentation is stored separately, so we need