From 52f61ee879e1100f40dc77252a3db497e2555047 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Fri, 18 Feb 2022 00:12:46 +0000 Subject: [PATCH] Add deps Update Dockerfile Update Makefile --- .pre-commit-config.yaml | 8 ++++++++ Makefile | 8 +++++--- dev/Dockerfile | 2 +- setup.cfg | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 84805b4cc..df29ecbce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,14 @@ repos: - id: mixed-line-ending - id: trailing-whitespace + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.931 + hooks: + - id: mypy + exclude: ^tests/ + args: + - --config-file=setup.cfg + - repo: https://github.com/codespell-project/codespell rev: v2.1.0 hooks: diff --git a/Makefile b/Makefile index ec0419d77..158bf775f 100644 --- a/Makefile +++ b/Makefile @@ -26,9 +26,11 @@ run-tests: ## Run CI tests docker build -f .circleci/Dockerfile . -t astronomer-operators-ci docker run --rm -it astronomer-operators-ci pytest tests -run-static-checks: ## Run CI static code checks - docker build -f .circleci/Dockerfile . -t astronomer-operators-ci - docker run --rm -it astronomer-operators-ci pre-commit run --all-files +run-mypy: ## Run CI static code checks + docker build -f dev/Dockerfile . -t astronomer-operators-dev + docker run -t --rm astronomer-operators-dev\ + /bin/bash -c "mypy --install-types --config-file astronomer_operators/setup.cfg ./astronomer_operators" \ + -v ../../astronomer-operators:/usr/local/airflow/astronomer_operators help: ## Prints this message @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/dev/Dockerfile b/dev/Dockerfile index cb5396618..bd8992f8d 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -6,5 +6,5 @@ COPY astronomer/ ${AIRFLOW_HOME}/astronomer_providers/astronomer/ COPY setup.cfg ${AIRFLOW_HOME}/astronomer_providers/setup.cfg COPY pyproject.toml ${AIRFLOW_HOME}/astronomer_providers/pyproject.toml -RUN pip install -e ${AIRFLOW_HOME}/astronomer_providers +RUN pip install -e ${AIRFLOW_HOME}/astronomer_providers[tests] USER astro diff --git a/setup.cfg b/setup.cfg index 95d10b751..031132e5e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,6 +61,27 @@ tests = pre-commit pytest pytest-asyncio + types-aiofiles + types-boto + types-certifi + types-croniter + types-Deprecated + types-docutils + types-freezegun + types-paramiko + types-protobuf + types-python-dateutil + types-python-slugify + types-pytz + types-redis + types-requests + types-setuptools + types-termcolor + types-tabulate + types-toml + types-Markdown + types-PyMySQL + types-PyYAML [options.packages.find] include = @@ -90,6 +111,9 @@ no_implicit_optional = True warn_redundant_casts = True pretty = True show_error_codes = True +strict = True +show_error_context = True +color_output = True [mypy-airflow.*] ignore_missing_imports = True