From 5851cd4e3799b470848dc197af4abcd8d69cefc0 Mon Sep 17 00:00:00 2001 From: cn Date: Sat, 8 Aug 2020 21:26:49 +0200 Subject: [PATCH] module: adopt Poetry dependency manager --- .github/workflows/ci.yml | 12 +++--------- .gitignore | 1 + Makefile | 23 +++++++++++++++++++++++ Pipfile | 15 --------------- pyproject.toml | 22 ++++++++++++++++++++++ 5 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 Makefile delete mode 100644 Pipfile create mode 100644 pyproject.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a66823..401fdf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,14 +16,8 @@ jobs: python-version: 3.8 - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install pipenv - pipenv install --dev --deploy - - name: Formatting - run: | - # check that the source files are formatted correctly - pipenv run yapf -q *.py + pip install poetry + poetry install - name: Linting run: | - pipenv run mypy *.py - pipenv run pylint *.py + make lint diff --git a/.gitignore b/.gitignore index d7f7a42..06017d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .mypy_cache +poetry.lock diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee5f83c --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ + +# https://tech.davis-hansson.com/p/make/ +SHELL := bash +.ONESHELL: +.SILENT: +.SHELLFLAGS := -eux -o pipefail -c +.DELETE_ON_ERROR: +.DEFAULT_GOAL := all +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules + +.PHONY: all +all: lint ## Run lint and test (default goal) + +.PHONY: lint +lint: ## Lint all source code + poetry run yapf -q *.py + poetry run pylint *.py + poetry run mypy *.py + +.PHONY: help +help: ## Print this help text + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' diff --git a/Pipfile b/Pipfile deleted file mode 100644 index c5723dc..0000000 --- a/Pipfile +++ /dev/null @@ -1,15 +0,0 @@ -[[source]] -url = 'https://pypi.python.org/simple' - -[requires] -python_version = '3.8' - -[packages] -pyyaml = '*' -requests = '*' - -[dev-packages] -rope = '==0.17.0' -pylint = '==2.5.3' -yapf = '==0.30.0' -mypy = '== 0.782' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f5f9cd5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["poetry>=1.0"] +build-backend = "poetry.masonry.api" + +[tool.poetry] +name = "kube-stale-resources" +version = "1.0.0" +description = "Utility augmenting 'kubectl diff' to detect stale resources in Kubernetes clusters between local YAML manifests (target state) and the cluster (live state)." +authors = ["Christian Nicolai"] +license = "Apache-2.0" +homepage = "https://dev.mycrobase.de/gitea/cn/kube-stale-resources" + +[tool.poetry.dependencies] +python = "^3.8" +pyyaml = "5.3.1" +requests = "2.24.0" + +[tool.poetry.dev-dependencies] +mypy = "0.782" +pylint = "2.5.3" +rope = "0.17.0" +yapf = "0.30.0"