-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 1.45 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
# globals
PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PROJECT_NAME = grid_world
## ------------------------------------------------------------------
## This Makefile contains utilities you can use while developing this
## project.
.PHONY: environment
environment: ## create environment
pyenv install -s 3.11.1
pyenv virtualenv 3.11.1 grid_world
pyenv local grid_world
.PHONY: requirements
requirements: ## install all requirements
pip install -Ur requirements.txt
.PHONY: black-check
black-check: ## check Black code style
@echo ""
@echo "\033[33mBlack Code Style\033[0m"
@echo "\033[33m================\033[0m"
@echo ""
@python -m black --check --exclude="build/|buck-out/|dist/|_build/\
|pip/|env/|\.pip/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/" . \
&& echo "\n\n\033[32mSuccess\033[0m\n" || (python -m black --diff \
--exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/|\
\.hg/|\.mypy_cache/|\.tox/|\.venv/" . 2>&1 | grep -v -e reformatted -e done \
&& echo "\n\033[31mFailure\033[0m\n\n\
\033[34mRun \"\e[4mmake black\e[24m\" to apply style formatting to your code\
\033[0m\n" && exit 1)
.PHONY: black
black: ## apply the Black code style to code
black --exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/" .
.PHONY: test
test: ## run all tests under test dir
pytest tests
.PHONY: validate
validate: ## validate project for merging
make black-check
make test