forked from axon-rl/gem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.79 KB
/
Makefile
File metadata and controls
60 lines (46 loc) · 1.79 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
print-%: ; @echo $* = $($*)
SHELL=/bin/bash
PROJECT_NAME = gem
COPYRIGHT = "AxonRL Team. All Rights Reserved."
PROJECT_PATH = gem
SOURCE_FOLDERS = $(PROJECT_PATH) tests examples
LINT_PATHS = ${PROJECT_PATH} tests examples
check_install = python3 -c "import $(1)" || pip3 install $(1) --upgrade
check_install_extra = python3 -c "import $(1)" || pip3 install $(2) --upgrade
go-install:
# requires go >= 1.16
command -v go || (sudo apt-get install -y golang && sudo ln -sf /usr/lib/go/bin/go /usr/bin/go)
addlicense-install: go-install
command -v addlicense || go install github.com/google/addlicense@latest
test:
$(call check_install, pytest)
pytest -s
lint:
$(call check_install, isort)
$(call check_install, pylint)
isort --check --diff --project=${LINT_PATHS}
pylint -j 8 --recursive=y ${LINT_PATHS}
format:
$(call check_install, autoflake)
autoflake --remove-all-unused-imports -i -r ${LINT_PATHS}
$(call check_install, black)
black ${LINT_PATHS}
$(call check_install, isort)
isort ${LINT_PATHS}
check-docstyle:
$(call check_install, pydocstyle)
pydocstyle ${PROJECT_PATH} --convention=google
checks: lint check-docstyle
clean:
@-rm -rf build/ dist/ .eggs/ site/ *.egg-info .pytest_cache .mypy_cache .ruff_cache
@-find . -name '*.pyc' -type f -exec rm -rf {} +
@-find . -name '__pycache__' -exec rm -rf {} +
package: clean
PRODUCTION_MODE=yes python setup.py bdist_wheel
publish: package
twine upload dist/*
addlicense: addlicense-install
$$(command -v addlicense || echo $(HOME)/go/bin/addlicense) -c $(COPYRIGHT) -ignore tests/coverage.xml -l apache $(SOURCE_FOLDERS)
check-license: addlicense-install
$$(command -v addlicense || echo $(HOME)/go/bin/addlicense) -c $(COPYRIGHT) -ignore tests/coverage.xml -l apache -check $(SOURCE_FOLDERS)
.PHONY: format lint check-docstyle checks