From 5b64ced497ccbb6de246d61917ad67c6f7d373d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Wed, 27 Sep 2023 10:30:52 +0200 Subject: [PATCH] check: verify python with mypy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verify all our python scripts with mypy during `make check'. Also, install mypy during CI and mention it in the README. Signed-off-by: Vincent Stehlé --- .github/workflows/main.yaml | 2 +- .mypy.ini | 2 ++ Makefile | 1 + README.rst | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .mypy.ini diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 09e092d..9fe6ab9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -31,7 +31,7 @@ jobs: run: | sudo apt update sudo apt install python3-pip latexmk libalgorithm-diff-perl texlive \ - texlive-latex-extra texlive-humanities flake8 + texlive-latex-extra texlive-humanities flake8 mypy - name: 'Install Python required packages' run: | diff --git a/.mypy.ini b/.mypy.ini new file mode 100644 index 0000000..be0671c --- /dev/null +++ b/.mypy.ini @@ -0,0 +1,2 @@ +[mypy] +strict = true diff --git a/Makefile b/Makefile index 7f88652..7d41dfe 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ help: check: ! grep -r --file=.typos.txt --exclude=.typos.txt --exclude-dir=.git flake8 . + mypy . $(SPHINXBUILD) -M linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) # Catch-all target: route all unknown targets to Sphinx using the new diff --git a/README.rst b/README.rst index 3ba19f8..d120aad 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ Requirements * Sphinx version 1.5 or later: http://sphinx-doc.org/en/master/contents.html * LaTeX (and pdflatex, and various LaTeX packages) -* Optionally, for verification: ``flake8`` +* Optionally, for verification: ``flake8`` and ``mypy`` On Debian and Ubuntu ^^^^^^^^^^^^^^^^^^^^