From 8d8c8bd89f8e8446c0246176a176c5d344417b36 Mon Sep 17 00:00:00 2001 From: Gao Hanxiang Date: Thu, 22 Jul 2021 08:04:27 -0400 Subject: [PATCH] chore: Add make clean to clean up project directory 1. Add make clean 2. Specify configuration file used by mypy 3. Add some directories to dockerignore Change-Id: I4f6b0d5ba894214bb0fcff21443f9808f56d595e --- .dockerignore | 4 ++++ Makefile | 8 ++++++++ libs/skyline-apiserver/Makefile | 11 ++++++++--- alembic.ini => libs/skyline-apiserver/alembic.ini | 0 libs/skyline-config/Makefile | 11 ++++++++--- libs/skyline-log/Makefile | 11 ++++++++--- libs/skyline-nginx/Makefile | 11 ++++++++--- libs/skyline-policy-manager/Makefile | 11 ++++++++--- mypy.ini | 2 ++ 9 files changed, 54 insertions(+), 15 deletions(-) rename alembic.ini => libs/skyline-apiserver/alembic.ini (100%) diff --git a/.dockerignore b/.dockerignore index a95db69..2e06ed2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -78,3 +78,7 @@ tmp/ # Remove build context **/.git **/tmp +**/.mypy_cache +**/dist +**/node_modules +**/__pycache__ diff --git a/Makefile b/Makefile index b170001..fb97295 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,14 @@ $(TEST_LIBS): $(MAKE) -C $(basename $@) test +.PHONY: clean $(CLEAN_LIBS) +CLEAN_LIBS := $(addsuffix .clean,$(LIB_PATHS)) +clean: $(CLEAN_LIBS) + rm -rf .venv dist +$(CLEAN_LIBS): + $(MAKE) -C $(basename $@) clean + + .PHONY: build BUILD_ENGINE ?= docker BUILD_CONTEXT ?= . diff --git a/libs/skyline-apiserver/Makefile b/libs/skyline-apiserver/Makefile index 3279c1a..c4a2103 100644 --- a/libs/skyline-apiserver/Makefile +++ b/libs/skyline-apiserver/Makefile @@ -42,10 +42,10 @@ fmt: .PHONY: lint lint: - # poetry run mypy --no-incremental $$(git ls-files -- **/*.py) - poetry run isort --check-only --diff $$(git ls-files -- **/*.py) + # poetry run mypy --config-file=../../mypy.ini $$(git ls-files -- **/*.py) + poetry run isort --check-only --diff $$(git ls-files -- **/*.py) poetry run black --check --diff --color --config ../../pyproject.toml $$(git ls-files -- **/*.py) - poetry run flake8 $$(git ls-files -- **/*.py) + poetry run flake8 $$(git ls-files -- **/*.py) .PHONY: test @@ -53,6 +53,11 @@ test: echo TODO +.PHONY: clean +clean: + rm -rf .venv dist + + .PHONY: db_revision HEAD_REV ?= $(shell poetry run alembic heads | awk '{print $$1}') NEW_REV ?= $(shell python3 -c 'import sys; print(f"{int(sys.argv[1])+1:03}")' $(HEAD_REV)) diff --git a/alembic.ini b/libs/skyline-apiserver/alembic.ini similarity index 100% rename from alembic.ini rename to libs/skyline-apiserver/alembic.ini diff --git a/libs/skyline-config/Makefile b/libs/skyline-config/Makefile index 5695936..4f08377 100644 --- a/libs/skyline-config/Makefile +++ b/libs/skyline-config/Makefile @@ -30,12 +30,17 @@ fmt: .PHONY: lint lint: - poetry run mypy --no-incremental $$(git ls-files -- **/*.py) - poetry run isort --check-only --diff $$(git ls-files -- **/*.py) + poetry run mypy --config-file=../../mypy.ini $$(git ls-files -- **/*.py) + poetry run isort --check-only --diff $$(git ls-files -- **/*.py) poetry run black --check --diff --color --config ../../pyproject.toml $$(git ls-files -- **/*.py) - poetry run flake8 $$(git ls-files -- **/*.py) + poetry run flake8 $$(git ls-files -- **/*.py) .PHONY: test test: echo TODO + + +.PHONY: clean +clean: + rm -rf .venv dist diff --git a/libs/skyline-log/Makefile b/libs/skyline-log/Makefile index 5695936..4f08377 100644 --- a/libs/skyline-log/Makefile +++ b/libs/skyline-log/Makefile @@ -30,12 +30,17 @@ fmt: .PHONY: lint lint: - poetry run mypy --no-incremental $$(git ls-files -- **/*.py) - poetry run isort --check-only --diff $$(git ls-files -- **/*.py) + poetry run mypy --config-file=../../mypy.ini $$(git ls-files -- **/*.py) + poetry run isort --check-only --diff $$(git ls-files -- **/*.py) poetry run black --check --diff --color --config ../../pyproject.toml $$(git ls-files -- **/*.py) - poetry run flake8 $$(git ls-files -- **/*.py) + poetry run flake8 $$(git ls-files -- **/*.py) .PHONY: test test: echo TODO + + +.PHONY: clean +clean: + rm -rf .venv dist diff --git a/libs/skyline-nginx/Makefile b/libs/skyline-nginx/Makefile index 5695936..4f08377 100644 --- a/libs/skyline-nginx/Makefile +++ b/libs/skyline-nginx/Makefile @@ -30,12 +30,17 @@ fmt: .PHONY: lint lint: - poetry run mypy --no-incremental $$(git ls-files -- **/*.py) - poetry run isort --check-only --diff $$(git ls-files -- **/*.py) + poetry run mypy --config-file=../../mypy.ini $$(git ls-files -- **/*.py) + poetry run isort --check-only --diff $$(git ls-files -- **/*.py) poetry run black --check --diff --color --config ../../pyproject.toml $$(git ls-files -- **/*.py) - poetry run flake8 $$(git ls-files -- **/*.py) + poetry run flake8 $$(git ls-files -- **/*.py) .PHONY: test test: echo TODO + + +.PHONY: clean +clean: + rm -rf .venv dist diff --git a/libs/skyline-policy-manager/Makefile b/libs/skyline-policy-manager/Makefile index cdb2af5..442315f 100644 --- a/libs/skyline-policy-manager/Makefile +++ b/libs/skyline-policy-manager/Makefile @@ -31,12 +31,17 @@ fmt: .PHONY: lint lint: - poetry run mypy --no-incremental $$(git ls-files -- **/*.py) - poetry run isort --check-only --diff $$(git ls-files -- **/*.py) + poetry run mypy --config-file=../../mypy.ini $$(git ls-files -- **/*.py) + poetry run isort --check-only --diff $$(git ls-files -- **/*.py) poetry run black --check --diff --color --config ../../pyproject.toml $$(git ls-files -- **/*.py) - poetry run flake8 $$(git ls-files -- **/*.py) + poetry run flake8 $$(git ls-files -- **/*.py) .PHONY: test test: echo TODO + + +.PHONY: clean +clean: + rm -rf .venv dist diff --git a/mypy.ini b/mypy.ini index fe3fe7e..2278bf6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,6 @@ [mypy] +incremental = false +cache_dir = /dev/null show_error_codes = true show_error_context = true