-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (64 loc) · 3.92 KB
/
Makefile
File metadata and controls
78 lines (64 loc) · 3.92 KB
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
.PHONY: all
## Generate sync unit tests, format, lint, and test
all: precommit
.PHONY: install-poetry
## Bootstrap installing poetry
install-poetry:
curl -sSL https://install.python-poetry.org | python3 -
.PHONY: install
## Install project and dependencies
install:
@poetry install
.PHONY: format
## Format the code using ruff
format:
@poetry run ruff format src tests
.PHONY: lint
## Lint the code using ruff and mypy
lint:
@poetry run ruff check src tests
@poetry run mypy src tests
.PHONY: do-gen-sync
do-gen-sync:
# cache client
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_scs_control_client.py src/momento/internal/synchronous/_scs_control_client.py
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_scs_data_client.py src/momento/internal/synchronous/_scs_data_client.py
@poetry run python src/momento/internal/codegen.py src/momento/cache_client_async.py src/momento/cache_client.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/shared_behaviors_async.py tests/momento/cache_client/shared_behaviors.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_init_async.py tests/momento/cache_client/test_init.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_control_async.py tests/momento/cache_client/test_control.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_dictionary_async.py tests/momento/cache_client/test_dictionary.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_list_async.py tests/momento/cache_client/test_list.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_scalar_async.py tests/momento/cache_client/test_scalar.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_set_async.py tests/momento/cache_client/test_set.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_sorted_set_async.py tests/momento/cache_client/test_sorted_set.py
@poetry run python src/momento/internal/codegen.py tests/momento/cache_client/test_sorted_set_simple_async.py tests/momento/cache_client/test_sorted_set_simple.py
# auth client
@poetry run python src/momento/internal/codegen.py src/momento/internal/aio/_scs_token_client.py src/momento/internal/synchronous/_scs_token_client.py
@poetry run python src/momento/internal/codegen.py src/momento/auth_client_async.py src/momento/auth_client.py
@poetry run python src/momento/internal/codegen.py tests/momento/auth_client/test_auth_client_async.py tests/momento/auth_client/test_auth_client.py
.PHONY: gen-sync
## Generate synchronous code and tests from asynchronous code.
gen-sync: do-gen-sync format lint
.PHONY: test
## Run unit and integration tests with pytest
test:
@poetry run pytest -m "not local and not subscription_initialization"
.PHONY: test-local
## Run the integration tests that require Momento Local
test-local:
@poetry run pytest -m local
test-subscription-initialization:
@poetry run pytest -m subscription_initialization
.PHONY: precommit
## Run format, lint, and test as a step before committing.
precommit: gen-sync format lint test
.PHONY: clean
## Remove intermediate files
clean:
@rm -rf dist .mypy_cache .pytest_cache
@find . -name "*__pycache__*" | xargs rm -rf
# See <https://gist.github.com/klmr/575726c7e05d8780505a> for explanation.
.PHONY: help
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'|more $(shell test $(shell uname) == Darwin && echo '-Xr')