You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/04/05 10:04:52 UTC
[buildstream-plugins] 37/49: tox.ini: Adding mypy static type checking
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/buildstream-plugins.git
commit 1ba6cc3d467b5d8cd6023d23054a09970320d5ce
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Mar 24 15:04:48 2022 +0900
tox.ini: Adding mypy static type checking
---
requirements/mypy-requirements.txt | 7 +++++++
setup.cfg | 10 ++++++++++
tox.ini | 18 ++++++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/requirements/mypy-requirements.txt b/requirements/mypy-requirements.txt
new file mode 100644
index 0000000..20378a3
--- /dev/null
+++ b/requirements/mypy-requirements.txt
@@ -0,0 +1,7 @@
+# Additional requirements for running mypy
+
+# For cargo plugin
+types-toml
+
+# For docker plugin
+types-requests
diff --git a/setup.cfg b/setup.cfg
index 2796004..8058ebb 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -10,3 +10,13 @@ markers =
datafiles: share datafiles in tests
env =
D:BST_TEST_SUITE=True
+
+[mypy]
+files = src
+warn_unused_configs = True
+warn_no_return = True
+
+# Ignore missing stubs for third-party packages.
+# In future, these should be re-enabled if/when stubs for them become available.
+[mypy-copyreg,grpc,pluginbase,psutil,pyroaring,ruamel,multiprocessing.forkserver]
+ignore_missing_imports=True
diff --git a/tox.ini b/tox.ini
index 44e0d0c..840c174 100644
--- a/tox.ini
+++ b/tox.ini
@@ -82,6 +82,24 @@ commands_pre =
commands =
pylint {posargs: buildstream_plugins tests setup.py}
+#
+# Running static type checkers
+#
+[testenv:mypy]
+skip_install = True
+commands =
+ mypy {posargs}
+deps =
+ mypy==0.910
+ types-protobuf
+ types-python-dateutil
+ types-setuptools
+ types-ujson
+ -rrequirements/plugin-requirements.txt
+ -rrequirements/test-requirements.txt
+ -rrequirements/mypy-requirements.txt
+ git+https://github.com/apache/buildstream@{env:BST_VERSION}
+
#
# Building documentation
#