-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
68 lines (56 loc) · 2.38 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
.DEFAULT_GOAL := help
.PHONY: deps tox tox-current test lint format test-all-versions help
REPO_ROOT:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
deps: ## install deps (library & development)
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
python3 -m pip install setuptools wheel
deps-genproto: ## install deps (library & development)
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-genproto.txt
tox: ## run ALL checks for ALL available python versions
python3 -m tox
tox-current: ## run ALL checks ONLY for current python version
python3 -m tox -e `python3 -c 'import platform; print("py" + "".join(platform.python_version_tuple()[:2]))'`
test: ## run tests ONLY for current python version
python3 -m pytest
lint: ## run linters, formatters for current python versions
python3 -m flake8 yandexcloud
python3 -m pylint yandexcloud
python3 -m mypy yandexcloud
format:
python3 -m isort yandexcloud setup.py tests examples
python3 -m black yandexcloud setup.py tests examples
test-all-versions: ## run test for multiple python versions using docker
# python 3.12 not provided in image so we skip it
docker run --rm -v $(REPO_ROOT):/src ghcr.io/fkrull/docker-multi-python:bionic tox -c /src -e py38,py39,py310,py311
submodule: ## update submodules
git submodule update --init --recursive --remote
proto: ## regenerate code from protobuf
rm -rf yandex
python3 -m grpc_tools.protoc \
--proto_path=cloudapi \
--proto_path=cloudapi/third_party/googleapis \
--python_out=. \
--mypy_out=. \
--grpc_python_out=. \
--mypy_grpc_out=. \
`find cloudapi/yandex -name '*.proto'`
find yandex -type d -exec touch {}/__init__.py \;
touch yandex/py.typed \;
help: ## Show help message
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%s\n\n" "Usage: make [task]"; \
printf "%-20s %s\n" "task" "help" ; \
printf "%-20s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-20s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done