Skip to content

Commit d2fa4c5

Browse files
author
Andrew Brookins
committed
Add Makefile, black, reformat with black
1 parent cfc50b8 commit d2fa4c5

16 files changed

+979
-367
lines changed

.install.stamp

Whitespace-only changes.

Makefile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
NAME := redis_developer
2+
INSTALL_STAMP := .install.stamp
3+
POETRY := $(shell command -v poetry 2> /dev/null)
4+
5+
.DEFAULT_GOAL := help
6+
7+
.PHONY: help
8+
help:
9+
@echo "Please use 'make <target>' where <target> is one of"
10+
@echo ""
11+
@echo " install install packages and prepare environment"
12+
@echo " clean remove all temporary files"
13+
@echo " lint run the code linters"
14+
@echo " format reformat code"
15+
@echo " test run all the tests"
16+
@echo " shell open a Poetry shell"
17+
@echo ""
18+
@echo "Check the Makefile to know exactly what each target is doing."
19+
20+
install: $(INSTALL_STAMP)
21+
$(INSTALL_STAMP): pyproject.toml poetry.lock
22+
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
23+
$(POETRY) install
24+
touch $(INSTALL_STAMP)
25+
26+
.PHONY: clean
27+
clean:
28+
find . -type d -name "__pycache__" | xargs rm -rf {};
29+
rm -rf $(INSTALL_STAMP) .coverage .mypy_cache
30+
31+
.PHONY: lint
32+
lint: $(INSTALL_STAMP)
33+
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
34+
$(POETRY) run black ./tests/ $(NAME)
35+
$(POETRY) run flake8 --ignore=W503,E501,F401,E731 ./tests/ $(NAME)
36+
$(POETRY) run mypy ./tests/ $(NAME) --ignore-missing-imports
37+
$(POETRY) run bandit -r $(NAME) -s B608
38+
39+
.PHONY: format
40+
format: $(INSTALL_STAMP)
41+
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
42+
$(POETRY) run black ./tests/ $(NAME)
43+
44+
.PHONY: test
45+
test: $(INSTALL_STAMP)
46+
#$(POETRY) run pytest ./tests/ --cov-report term-missing --cov-fail-under 100 --cov $(NAME)
47+
$(POETRY) run pytest ./tests/
48+
49+
.PHONY: shell
50+
shell: $(INSTALL_STAMP)
51+
$(POETRY) shell
52+
53+
.PHONY: redis
54+
redis:
55+
docker-compose up -d

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3.8"
2+
3+
services:
4+
redis:
5+
image: "redislabs/redismod:edge"
6+
entrypoint: ["redis-server", "--appendonly", "yes", "--loadmodule", "/usr/lib/redis/modules/rejson.so"]
7+
restart: always
8+
ports:
9+
- "6380:6379"
10+
volumes:
11+
- ./data:/data

0 commit comments

Comments
 (0)