From 3dbc1205d04e883280c83aad97ab0301947aab99 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 10 Sep 2021 14:41:51 +0200 Subject: [PATCH] Start linting with mypy --- api/Makefile | 3 ++- api/setup.py | 1 + python_apps/airtime-celery/Makefile | 3 ++- python_apps/airtime-celery/setup.py | 1 + python_apps/airtime_analyzer/Makefile | 3 ++- python_apps/airtime_analyzer/setup.py | 1 + python_apps/api_clients/Makefile | 3 ++- python_apps/api_clients/setup.py | 1 + python_apps/pypo/Makefile | 3 ++- python_apps/pypo/setup.py | 1 + tools/Makefile | 3 ++- tools/python.mk | 6 ++++++ tools/requirements-dev.txt | 1 + 13 files changed, 24 insertions(+), 6 deletions(-) diff --git a/api/Makefile b/api/Makefile index 6999c6187..60e3bf54a 100644 --- a/api/Makefile +++ b/api/Makefile @@ -4,6 +4,7 @@ include ../tools/python.mk PIP_INSTALL := --editable .[dev] PYLINT_ARG := libretimeapi +MYPY_ARG := libretimeapi -lint: .pylint +lint: .pylint .mypy clean: .clean diff --git a/api/setup.py b/api/setup.py index f255a60e7..c4a935e1a 100644 --- a/api/setup.py +++ b/api/setup.py @@ -34,6 +34,7 @@ setup( ], "dev": [ "psycopg2-binary", + "mypy", "pylint", ], }, diff --git a/python_apps/airtime-celery/Makefile b/python_apps/airtime-celery/Makefile index 135a53091..b74c3b0e1 100644 --- a/python_apps/airtime-celery/Makefile +++ b/python_apps/airtime-celery/Makefile @@ -4,6 +4,7 @@ include ../../tools/python.mk PIP_INSTALL := --editable .[dev] PYLINT_ARG := airtime-celery +MYPY_ARG := airtime-celery -lint: .pylint +lint: .pylint .mypy clean: .clean diff --git a/python_apps/airtime-celery/setup.py b/python_apps/airtime-celery/setup.py index c51705e96..d7aebdcbe 100644 --- a/python_apps/airtime-celery/setup.py +++ b/python_apps/airtime-celery/setup.py @@ -26,6 +26,7 @@ setup( extras_require={ "prod": [], "dev": [ + "mypy", "pylint", ], }, diff --git a/python_apps/airtime_analyzer/Makefile b/python_apps/airtime_analyzer/Makefile index 8ea046b30..d0c69d657 100644 --- a/python_apps/airtime_analyzer/Makefile +++ b/python_apps/airtime_analyzer/Makefile @@ -4,9 +4,10 @@ include ../../tools/python.mk PIP_INSTALL := --editable .[dev] PYLINT_ARG := airtime_analyzer tests +MYPY_ARG := airtime_analyzer tests PYTEST_ARG := --cov=airtime_analyzer tests -lint: .pylint +lint: .pylint .mypy fixtures: bash tests/fixtures/generate.sh diff --git a/python_apps/airtime_analyzer/setup.py b/python_apps/airtime_analyzer/setup.py index 87bbe673a..d1dd87475 100644 --- a/python_apps/airtime_analyzer/setup.py +++ b/python_apps/airtime_analyzer/setup.py @@ -37,6 +37,7 @@ setup( "prod": [], "dev": [ "distro", + "mypy", "pylint", "pytest", "pytest-cov", diff --git a/python_apps/api_clients/Makefile b/python_apps/api_clients/Makefile index 5da67fcae..28d7d7224 100644 --- a/python_apps/api_clients/Makefile +++ b/python_apps/api_clients/Makefile @@ -4,8 +4,9 @@ include ../../tools/python.mk PIP_INSTALL := --editable .[dev] PYLINT_ARG := api_clients tests +MYPY_ARG := api_clients tests PYTEST_ARG := --cov=api_clients tests -lint: .pylint +lint: .pylint .mypy test: .pytest clean: .clean diff --git a/python_apps/api_clients/setup.py b/python_apps/api_clients/setup.py index 480811043..d0f24290c 100644 --- a/python_apps/api_clients/setup.py +++ b/python_apps/api_clients/setup.py @@ -26,6 +26,7 @@ setup( extras_require={ "prod": [], "dev": [ + "mypy", "pylint", "pytest", "pytest-cov", diff --git a/python_apps/pypo/Makefile b/python_apps/pypo/Makefile index bd2ee0a9c..8f4eefc4c 100644 --- a/python_apps/pypo/Makefile +++ b/python_apps/pypo/Makefile @@ -4,6 +4,7 @@ include ../../tools/python.mk PIP_INSTALL := --editable .[dev] PYLINT_ARG := liquidsoap pypo +MYPY_ARG := liquidsoap pypo -lint: .pylint +lint: .pylint .mypy clean: .clean diff --git a/python_apps/pypo/setup.py b/python_apps/pypo/setup.py index d34252dc5..355143a6f 100644 --- a/python_apps/pypo/setup.py +++ b/python_apps/pypo/setup.py @@ -40,6 +40,7 @@ setup( extras_require={ "prod": [], "dev": [ + "mypy", "pylint", ], }, diff --git a/tools/Makefile b/tools/Makefile index a8cdf94c9..ad8adad3f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -4,8 +4,9 @@ include python.mk PIP_INSTALL := -r requirements-dev.txt PYLINT_ARG := tools +MYPY_ARG := . PYTEST_ARG := . -lint: .pylint +lint: .pylint .mypy test: .pytest clean: .clean diff --git a/tools/python.mk b/tools/python.mk index 46b642ef4..814cbcf92 100644 --- a/tools/python.mk +++ b/tools/python.mk @@ -5,6 +5,7 @@ CPU_CORES := $(shell nproc) # PIP_INSTALL := --editable .[dev] # PYLINT_ARG := +# MYPY_ARG := # PYTEST_ARG := VENV := venv @@ -19,6 +20,11 @@ $(VENV): source $(VENV)/bin/activate pylint --output-format=colorized $(PYLINT_ARG) || true +.PHONY: .mypy +.mypy: $(VENV) + source $(VENV)/bin/activate + mypy $(MYPY_ARG) || true + .PHONY: .pytest .pytest: $(VENV) source venv/bin/activate diff --git a/tools/requirements-dev.txt b/tools/requirements-dev.txt index 430110048..cda4c0a74 100644 --- a/tools/requirements-dev.txt +++ b/tools/requirements-dev.txt @@ -1,3 +1,4 @@ +mypy pylint pytest pytest-xdist