-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 loc) · 1.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# https://github.com/samuelcolvin/pydantic/blob/master/Makefile
.DEFAULT_GOAL := all
poetry = poetry run
isort = isort app/
black = black app/
mypy = mypy app/
flake8 = flake8 app/
pyupgrade = pyupgrade --py311-plus
# args := $(wordlist 2, 100, $(MAKECMDGOALS))
.PHONY: install-linting
install-linting:
poetry add flake8 black isort mypy pyupgrade -G dev
.PHONY: install
install: install-linting
pre-commit install
@echo 'installed development requirements'
.PHONY: lint
lint: install-linting
$(isort) --df --check-only
$(black) --diff --check
$(flake8)
.PHONY: format
format:
$(poetry) $(pyupgrade)
$(poetry) $(isort)
$(poetry) $(black)
# $(poetry) $(mypy)
$(poetry) $(flake8)
.PHONY: export-dependencies
export-dependencies:
poetry export -f requirements.txt --output requirements.txt
poetry export -f requirements.txt --output requirements-dev.txt --with=dev
.PHONY: database
database:
docker run --name postgresql -e POSTGRES_USER=myusername -e POSTGRES_PASSWORD=mypassword -p 5432:5432 -d postgres
.PHONY: test
test:
poetry run pytest --cov=app --cov-report=html
.PHONY: migrate
migrate:
@read -p "Enter migration message: " message; \
poetry run alembic revision --autogenerate -m "$$message"
.PHONY: downgrade
downgrade:
alembic downgrade -1
.PHONY: upgrade
upgrade:
alembic upgrade +1
.PHONY: upgrade-offline
upgrade-offline:
alembic upgrade head --sql
.PHONY: all
all: format export-dependencies