Skip to content

Commit

Permalink
[3.11] Docs: move sphinx-lint to pre-commit (GH-105750) (#108276)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Aug 22, 2023
1 parent d678ee7 commit 9d00379
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,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
- name: 'Upload'
Expand All @@ -37,8 +35,6 @@ jobs:
path: Doc/build/html

# 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
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.8
hooks:
- id: sphinx-lint
args: [--enable=default-role]
files: ^Doc/|^Misc/NEWS.d/next/
types: [rst]
8 changes: 3 additions & 5 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@ dist:
rm -r dist/python-$(DISTVERSION)-docs-texinfo
rm dist/python-$(DISTVERSION)-docs-texinfo.tar

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

serve:
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
Expand Down
4 changes: 0 additions & 4 deletions Doc/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion Doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sphinx==4.5.0

blurb

sphinx-lint==0.6.7
sphinxext-opengraph>=0.7.1

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

0 comments on commit 9d00379

Please sign in to comment.