Skip to content

Update documentation related settings #6292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
# Also change CACHE_VERSION in the other workflows
CACHE_VERSION: 5
CACHE_VERSION: 6
DEFAULT_PYTHON: 3.8
PRE_COMMIT_CACHE: ~/.cache/pre-commit

Expand Down Expand Up @@ -58,6 +58,7 @@ jobs:
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
pip install -U -r doc/requirements.txt
- name: Generate pre-commit restore key
id: generate-pre-commit-key
run: >-
Expand Down Expand Up @@ -155,7 +156,7 @@ jobs:
documentation:
name: documentation
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
needs: prepare-base
steps:
- name: Check out code from GitHub
Expand All @@ -182,3 +183,8 @@ jobs:
run: |
. venv/bin/activate
pytest doc/test_messages_documentation.py
- name: Check documentation build and links
run: |
. venv/bin/activate
cd doc
make html
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't add linkcheck to readthedocs as the only allow one build target (and they don't use make html but sphinx-build -b html directly).

Thus, we need our own CI to run linkcheck. Takes 2 additional minutes but I think that's okay considering the time most other jobs take.

6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ sphinx:
configuration: doc/conf.py

python:
version: 3.8
install:
- requirements: doc/requirements.txt

build:
os: ubuntu-20.04
tools:
python: "3.8"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python.version has been deprecated and should now be specified in the build tag

35 changes: 8 additions & 27 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ PYTHONPATH =
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -T -E -W --keep-going $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these flags as they are also used by readthedocs and we therefore mimic that behaviour locally now


.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest all
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck

help:
@echo "Please use \`make <target>' where <target> is one of"
Expand All @@ -34,21 +34,21 @@ help:
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(BUILDDIR)/*
-rm -f reference_guide/features.rst
-rm -f extensions.rst

html: features.rst extensions.rst
html:
@echo
@echo "Install dependencies"
$(PIP) install python-docs-theme
$(PIP) install furo
@echo "Finished installing dependencies"
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-b html already logs stuff like this to stdout. No reason to log twice.

@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."


dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand Down Expand Up @@ -132,22 +132,3 @@ linkcheck:
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."


extensions.rst: exts/pylint_extensions.py
extensions.rst: $(shell find ../pylint/extensions -type f -regex '.*\.py')
extensions.rst: $(shell find ../pylint/extensions -type f -regex '.*\.rst')
rm -f extensions.rst
PYTHONPATH=$(PYTHONPATH) $(PYTHON) ./exts/pylint_extensions.py

features.rst: exts/pylint_features.py
features.rst: $(shell find ../pylint/checkers -type f -regex '.*\.py')
rm -f features.rst
PYTHONPATH=$(PYTHONPATH) $(PYTHON) ./exts/pylint_features.py

messages: $(PYTHONPATH) $(PYTHON) ./exts/pylint_messages.py
28 changes: 6 additions & 22 deletions doc/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees -T -E -W --keep-going .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help
Expand All @@ -34,7 +32,6 @@ if "%1" == "help" (
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)

Expand All @@ -46,17 +43,13 @@ if "%1" == "clean" (


if "%1" == "html" (
rm -f features.rst
echo Pylint features > reference_guide/features.rst
echo =============== >> reference_guide/features.rst
echo >> reference_guide/features.rst
echo .. generated by pylint --full-documentation >> reference_guide/features.rst
echo >> reference_guide/features.rst
python -m pylint --full-documentation >> reference_guide/features.rst
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)

Expand Down Expand Up @@ -162,7 +155,7 @@ if "%1" == "texinfo" (
)

if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
%SPHINXBUILD% -b gettext %ALLSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
Expand All @@ -186,13 +179,4 @@ or in %BUILDDIR%/linkcheck/output.txt.
goto end
)

if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)

:end