From 0cd3f0dcbbd54f949a4ac7e382cab0279b261b37 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 29 Jun 2023 10:13:04 +0200 Subject: [PATCH 1/2] should fix the problem with build-imate step --- services/agent/Dockerfile | 2 +- services/api-server/Dockerfile | 2 +- services/autoscaling/Dockerfile | 2 +- services/catalog/Dockerfile | 2 +- services/dask-sidecar/Dockerfile | 2 +- services/datcore-adapter/Dockerfile | 2 +- services/director-v2/Dockerfile | 2 +- services/dynamic-sidecar/Dockerfile | 2 +- services/invitations/Dockerfile | 2 +- services/migration/Dockerfile | 2 +- services/resource-usage-tracker/Dockerfile | 2 +- services/storage/Dockerfile | 2 +- services/web/Dockerfile | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/services/agent/Dockerfile b/services/agent/Dockerfile index e466103550c..96bf80a4a14 100644 --- a/services/agent/Dockerfile +++ b/services/agent/Dockerfile @@ -110,7 +110,7 @@ WORKDIR /build/services/agent RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/agent,target=/build/services/agent,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/api-server/Dockerfile b/services/api-server/Dockerfile index fd89b719aa2..89a3a455610 100644 --- a/services/api-server/Dockerfile +++ b/services/api-server/Dockerfile @@ -106,7 +106,7 @@ WORKDIR /build/services/api-server RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/api-server,target=/build/services/api-server,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/autoscaling/Dockerfile b/services/autoscaling/Dockerfile index 953eab7e1df..68664eb439a 100644 --- a/services/autoscaling/Dockerfile +++ b/services/autoscaling/Dockerfile @@ -124,7 +124,7 @@ WORKDIR /build/services/autoscaling RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/autoscaling,target=/build/services/autoscaling,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/catalog/Dockerfile b/services/catalog/Dockerfile index 285e6fd183b..dad4b0aa9b4 100644 --- a/services/catalog/Dockerfile +++ b/services/catalog/Dockerfile @@ -106,7 +106,7 @@ WORKDIR /build/services/catalog RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/catalog,target=/build/services/catalog,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/dask-sidecar/Dockerfile b/services/dask-sidecar/Dockerfile index 59e49548a5f..9a8639f9ded 100644 --- a/services/dask-sidecar/Dockerfile +++ b/services/dask-sidecar/Dockerfile @@ -110,7 +110,7 @@ WORKDIR /build/services/dask-sidecar RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/dask-sidecar,target=/build/services/dask-sidecar,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/datcore-adapter/Dockerfile b/services/datcore-adapter/Dockerfile index ae4ca7da547..56435f82b40 100644 --- a/services/datcore-adapter/Dockerfile +++ b/services/datcore-adapter/Dockerfile @@ -107,7 +107,7 @@ WORKDIR /build/services/datcore-adapter RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/datcore-adapter,target=/build/services/datcore-adapter,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/director-v2/Dockerfile b/services/director-v2/Dockerfile index d60bf39e3b7..5d5afebdd23 100644 --- a/services/director-v2/Dockerfile +++ b/services/director-v2/Dockerfile @@ -107,7 +107,7 @@ WORKDIR /build/services/director-v2 RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/director-v2,target=/build/services/director-v2,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/dynamic-sidecar/Dockerfile b/services/dynamic-sidecar/Dockerfile index c848014c628..6c091d2b540 100644 --- a/services/dynamic-sidecar/Dockerfile +++ b/services/dynamic-sidecar/Dockerfile @@ -122,7 +122,7 @@ WORKDIR /build/services/dynamic-sidecar RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/dynamic-sidecar,target=/build/services/dynamic-sidecar,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/invitations/Dockerfile b/services/invitations/Dockerfile index 803dde6a76d..61725547487 100644 --- a/services/invitations/Dockerfile +++ b/services/invitations/Dockerfile @@ -107,7 +107,7 @@ WORKDIR /build/services/invitations RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/invitations,target=/build/services/invitations,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/migration/Dockerfile b/services/migration/Dockerfile index ba55f393490..d0ec8a9ee42 100644 --- a/services/migration/Dockerfile +++ b/services/migration/Dockerfile @@ -58,7 +58,7 @@ WORKDIR /build/packages/postgres-database # install only base 3rd party dependencies RUN \ --mount=type=bind,source=packages/postgres-database,target=/build/packages/postgres-database,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/resource-usage-tracker/Dockerfile b/services/resource-usage-tracker/Dockerfile index a5d5465afac..8ff863203ce 100644 --- a/services/resource-usage-tracker/Dockerfile +++ b/services/resource-usage-tracker/Dockerfile @@ -107,7 +107,7 @@ WORKDIR /build/services/resource-usage-tracker RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/resource-usage-tracker,target=/build/services/resource-usage-tracker,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/storage/Dockerfile b/services/storage/Dockerfile index b1531fb9c05..f860c6f4d73 100644 --- a/services/storage/Dockerfile +++ b/services/storage/Dockerfile @@ -119,7 +119,7 @@ WORKDIR /build/services/storage RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/storage,target=/build/services/storage,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v diff --git a/services/web/Dockerfile b/services/web/Dockerfile index d9263bff96c..ef430019588 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -117,7 +117,7 @@ WORKDIR /build/services/web/server RUN \ --mount=type=bind,source=packages,target=/build/packages,rw \ --mount=type=bind,source=services/web/server,target=/build/services/web/server,rw \ - --mount=type=cache,mode=0755,target=/root/.cache/pip \ + --mount=type=cache,mode=0755,target=/root/.cache/pip,sharing=private \ pip install \ --requirement requirements/prod.txt \ && pip list -v From fcd0d88081086b384dd8cb0ddf62f1e1c5f4f73c Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 29 Jun 2023 10:13:53 +0200 Subject: [PATCH 2/2] ruff improvements --- .ruff.toml | 25 ++++++++++++++++++++++++- Makefile | 5 +++++ scripts/common.Makefile | 7 +++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.ruff.toml b/.ruff.toml index cb27adbcd48..56a13d17ef2 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -45,4 +45,27 @@ ignore = [ "S101", # use of `assert` detected hanbled by pylance, does not support noseq "TID252", # [*] Relative imports from parent modules are banned ] -extend-exclude = ["**/tests", "**/generated_models", "**/director/"] + +target-version = "py310" + + +[per-file-ignores] +"**/tests/**" = [ + "T201", # print found + "ARG001", # unused function argument + "PT019", # user pytest.mark.usefixture + "PLR2004", # use of magic values + "PLR0913", # too many arguments + "N806", # Uppercase variables in functions + "PT001", # use pytest.fixture over pytest.fixture() whatsoever + "ERA001", # found commented out code +] + +[flake8-pytest-style] +fixture-parentheses = false +parametrize-names-type = "csv" + + + +[pylint] +max-args = 10 diff --git a/Makefile b/Makefile index d16292773ac..fa307976310 100644 --- a/Makefile +++ b/Makefile @@ -514,6 +514,11 @@ ruff: ## python ruffing @ruff --version # Running ruff in packages and services (except director) @ruff check \ + --config=$(CURDIR)/.ruff.toml \ + --respect-gitignore \ + --extend-exclude="**/tests" \ + --extend-exclude="**/generated_models" \ + --extend-exclude="**/director/" \ $(CURDIR)/services \ $(CURDIR)/packages diff --git a/scripts/common.Makefile b/scripts/common.Makefile index 56055c75a8d..110ecdc92b1 100644 --- a/scripts/common.Makefile +++ b/scripts/common.Makefile @@ -129,6 +129,13 @@ pyupgrade: ## upgrades python syntax for newer versions of the language (SEE htt pylint: $(REPO_BASE_DIR)/.pylintrc ## runs pylint (python linter) on src and tests folders @pylint --rcfile="$(REPO_BASE_DIR)/.pylintrc" -v $(CURDIR)/src $(CURDIR)/tests +.PHONY: ruff +ruff: $(REPO_BASE_DIR)/.ruff.toml ## runs ruff (python fast linter) on src and tests folders + @ruff check \ + --config=$(REPO_BASE_DIR)/.ruff.toml \ + --respect-gitignore \ + $(CURDIR)/src \ + $(CURDIR)/tests .PHONY: mypy mypy: $(REPO_BASE_DIR)/scripts/mypy.bash $(REPO_BASE_DIR)/mypy.ini ## runs mypy python static type-checker on this services's code. Use AFTER make install-*