2021-10-22 15:36:15 +02:00
|
|
|
NAME := redis_om
|
2021-10-20 22:01:46 +02:00
|
|
|
INSTALL_STAMP := .install.stamp
|
|
|
|
POETRY := $(shell command -v poetry 2> /dev/null)
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@echo "Please use 'make <target>' where <target> is one of"
|
|
|
|
@echo ""
|
|
|
|
@echo " install install packages and prepare environment"
|
|
|
|
@echo " clean remove all temporary files"
|
|
|
|
@echo " lint run the code linters"
|
|
|
|
@echo " format reformat code"
|
|
|
|
@echo " test run all the tests"
|
|
|
|
@echo " shell open a Poetry shell"
|
2021-10-20 23:29:31 +02:00
|
|
|
@echo " redis start a Redis instance with Docker"
|
2021-10-20 22:01:46 +02:00
|
|
|
@echo ""
|
|
|
|
@echo "Check the Makefile to know exactly what each target is doing."
|
|
|
|
|
|
|
|
install: $(INSTALL_STAMP)
|
|
|
|
$(INSTALL_STAMP): pyproject.toml poetry.lock
|
|
|
|
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
|
|
|
|
$(POETRY) install
|
|
|
|
touch $(INSTALL_STAMP)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
find . -type d -name "__pycache__" | xargs rm -rf {};
|
|
|
|
rm -rf $(INSTALL_STAMP) .coverage .mypy_cache
|
2021-10-22 15:53:39 +02:00
|
|
|
-rm -r dist
|
|
|
|
|
|
|
|
.PHONY: dist
|
|
|
|
dist: clean
|
|
|
|
$(POETRY) build
|
2021-10-20 22:01:46 +02:00
|
|
|
|
|
|
|
.PHONY: lint
|
2021-10-22 15:53:39 +02:00
|
|
|
lint: $(INSTALL_STAMP) dist
|
2021-10-20 22:01:46 +02:00
|
|
|
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
|
|
|
|
$(POETRY) run black ./tests/ $(NAME)
|
|
|
|
$(POETRY) run flake8 --ignore=W503,E501,F401,E731 ./tests/ $(NAME)
|
|
|
|
$(POETRY) run mypy ./tests/ $(NAME) --ignore-missing-imports
|
|
|
|
$(POETRY) run bandit -r $(NAME) -s B608
|
2021-10-22 15:53:39 +02:00
|
|
|
$(POETRY) run twine check dist/*
|
2021-10-20 22:01:46 +02:00
|
|
|
|
|
|
|
.PHONY: format
|
|
|
|
format: $(INSTALL_STAMP)
|
|
|
|
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
|
|
|
|
$(POETRY) run black ./tests/ $(NAME)
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: $(INSTALL_STAMP)
|
2021-10-21 08:24:31 +02:00
|
|
|
$(POETRY) run pytest -n auto -s -vv ./tests/ --cov-report term-missing --cov $(NAME)
|
2021-10-20 22:01:46 +02:00
|
|
|
|
|
|
|
.PHONY: shell
|
|
|
|
shell: $(INSTALL_STAMP)
|
|
|
|
$(POETRY) shell
|
|
|
|
|
|
|
|
.PHONY: redis
|
|
|
|
redis:
|
|
|
|
docker-compose up -d
|
2021-10-20 23:29:31 +02:00
|
|
|
|
|
|
|
.PHONY: all
|
2021-10-21 02:13:42 +02:00
|
|
|
all: redis $(INSTALL_STAMP) lint test
|