-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
98 lines (80 loc) · 2.21 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# https://www.gnu.org/software/make/manual/html_node/Makefile-Conventions.html
SHELL = /bin/bash
.ONESHELL:
.SUFFIXES:
LIB = aio_aws
.PHONY: clean
clean:
@rm -rf build dist .eggs *.egg-info
@rm -rf .benchmarks .coverage coverage.xml htmlcov prof report.xml .tox
@find . -type d -name '.mypy_cache' -exec rm -rf {} +
@find . -type d -name '__pycache__' -exec rm -rf {} +
@find . -type d -name '*pytest_cache*' -exec rm -rf {} +
@find . -type f -name "*.py[co]" -exec rm -rf {} +
.PHONY: docs
docs: clean
@cd docs
@rm -rf _build
@poetry run make html
@poetry run doc8
@echo -e "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"
.PHONY: flake8
flake8: clean
@poetry run flake8 --ignore=E501 $(LIB)
.PHONY: format
format: clean
@poetry run black $(LIB) tests docs *.py
.PHONY: init
init: poetry
@poetry env info
[[ -f pip.conf ]] && cp pip.conf $$(poetry env info -p)
poetry run python -m pip install --upgrade pip
poetry install -v --no-interaction --extras all
.PHONY: lint
lint: clean
@poetry run pylint --disable=missing-docstring tests
@poetry run pylint $(LIB)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
REDIS_EXEC = /usr/bin/redis-server
endif
ifeq ($(UNAME_S),Darwin)
REDIS_EXEC = /usr/local/bin/redis-server
endif
.PHONY: test
test: clean
@poetry run pytest -v \
--benchmark-disable \
--durations=10 \
--show-capture=no \
--redis-exec=$(REDIS_EXEC) \
--cov-config .coveragerc \
--cov-report html \
--cov-report term \
--cov=$(LIB) tests
.PHONY: typehint
typehint: clean
@poetry run mypy --follow-imports=skip $(LIB)
.PHONY: package
package: clean
@poetry check
@poetry build
.PHONY: package-check
package-check: package
@poetry run twine check dist/*
.PHONY: package-publish
package-publish: package-check
@poetry publish
.PHONY: poetry
poetry:
@if ! command -v poetry > /dev/null; then \
curl -sSL https://install.python-poetry.org | python -; \
fi
if ! echo "$PATH" | grep -Eq "(^|:)${HOME}/.local/bin($|:)"; then \
export PATH="${HOME}/.local/bin:${PATH}"; \
fi
poetry --version
.PHONY: poetry-export
poetry-export:
poetry export --without-hashes -f requirements.txt -o requirements.txt
sed -i -e 's/^-e //g' requirements.txt