-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathMakefile
98 lines (78 loc) · 2.14 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
PYTHONPATH = PYTHONPATH=./
POETRY_RUN = poetry run
PROTO_DIR = protos/tinkoff/invest/grpc
PACKAGE_PROTO_DIR = tinkoff/invest/grpc
OUT = .
PROTOS = protos
TEST = $(POETRY_RUN) pytest $(args)
MAIN_CODE = tinkoff examples scripts
CODE = tests $(MAIN_CODE)
.PHONY: test
test:
$(TEST) --cov
.PHONY: test-fast
test-fast:
$(TEST)
.PHONY: test-sandbox
test-sandbox:
$(TEST) --test-sandbox --cov
.PHONY: lint
lint:
$(POETRY_RUN) ruff $(CODE)
$(POETRY_RUN) black --check $(CODE)
$(POETRY_RUN) pytest --dead-fixtures --dup-fixtures
$(POETRY_RUN) mypy $(MAIN_CODE)
$(POETRY_RUN) poetry check
.PHONY: format
format:
$(POETRY_RUN) isort $(CODE)
$(POETRY_RUN) black $(CODE)
$(POETRY_RUN) ruff --fix $(CODE)
.PHONY: check
check: lint test
.PHONY: docs
docs:
mkdir -p ./docs
cp README.md ./docs/
cp CHANGELOG.md ./docs/
cp CONTRIBUTING.md ./docs/
$(POETRY_RUN) mkdocs build -s -v
.PHONY: docs-serve
docs-serve:
$(POETRY_RUN) mkdocs serve
.PHONY: next-version
next-version:
@$(POETRY_RUN) python -m scripts.version
.PHONY: bump-version
bump-version:
poetry version $(v)
$(POETRY_RUN) python -m scripts.update_package_version $(v)
$(POETRY_RUN) python -m scripts.update_issue_templates $(v)
git add . && git commit -m "chore(release): bump version to $(v)"
git tag -a $(v) -m ""
.PHONY: install-poetry
install-poetry:
pip install poetry==1.7.1
.PHONY: install-docs
install-docs:
poetry install --only docs
.PHONY: install-bump
install-bump:
poetry install --only bump
.PHONY: install
install:
poetry install -E all
.PHONY: publish
publish:
@poetry publish --build --no-interaction --username=$(pypi_username) --password=$(pypi_password)
.PHONY: download-protos
download-protos:
$(POETRY_RUN) python -m scripts.download_protos
.PHONY: gen-grpc
gen-grpc:
rm -r ${PACKAGE_PROTO_DIR}
$(POETRY_RUN) python -m grpc_tools.protoc -I${PROTOS} --python_out=${OUT} --mypy_out=${OUT} --grpc_python_out=${OUT} ${PROTO_DIR}/google/api/*.proto
$(POETRY_RUN) python -m grpc_tools.protoc -I${PROTOS} --python_out=${OUT} --mypy_out=${OUT} --grpc_python_out=${OUT} ${PROTO_DIR}/*.proto
touch ${PACKAGE_PROTO_DIR}/__init__.py
.PHONY: gen-client
gen-client: download-protos gen-grpc