From 7d316bb72a95eb6c82a2a9be912a8600f187012c Mon Sep 17 00:00:00 2001 From: m-roberts Date: Fri, 12 Nov 2021 18:46:57 +0000 Subject: [PATCH 1/2] Set up pre-commit for strict mode --- .pre-commit-config.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7cbcd588..8ade3c610 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,8 +42,19 @@ repos: hooks: - id: flake8 -# - repo: https://github.com/pre-commit/mirrors-mypy -# rev: v0.910 -# hooks: -# - id: mypy -# additional_dependencies: [types-all] +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.910 + hooks: + - id: mypy + additional_dependencies: [ + "types-all", # A shim for the typeshed changes in mypy 0.900 + ] + # "--ignore-missing-imports" prevents "Cannot find implementation or library stub for module" + # in pre-commit virtualenv + args: [ + "--ignore-missing-imports", + "--strict", + "--implicit-reexport", + "--pretty" + ] + exclude: ^examples From 2f20bb86d55a0d4249ae380dfdd77420ddab0a82 Mon Sep 17 00:00:00 2001 From: m-roberts Date: Fri, 12 Nov 2021 20:06:14 +0000 Subject: [PATCH 2/2] Fix conf.py --- .pre-commit-config.yaml | 3 +-- docs/conf.py | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ade3c610..799f62a7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,7 +54,6 @@ repos: args: [ "--ignore-missing-imports", "--strict", - "--implicit-reexport", - "--pretty" + "--implicit-reexport" ] exclude: ^examples diff --git a/docs/conf.py b/docs/conf.py index 8528fcadf..3a102597e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,7 +4,6 @@ # list see the documentation: # http://www.sphinx-doc.org/en/master/config -import importlib.util import os # -- Path setup -------------------------------------------------------------- @@ -20,16 +19,12 @@ # -- Project information ----------------------------------------------------- # Get package version directly from file -# -# Importing 'pitop' requires all core dependencies to be installed -# which is impractical for building docs -spec = importlib.util.spec_from_file_location("version", f"{PARENT}/pitop/version.py") -modulevar = importlib.util.module_from_spec(spec) -spec.loader.exec_module(modulevar) +with open(os.path.join(PARENT, "pitop", "version.txt"), "w") as f: + version = f.read().strip() project = "pitop" author = "pi-top (CEED Ltd)" -release = modulevar.__version__ +release = version copyright = "pi-top 2021" # -- General configuration ---------------------------------------------------