-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (59 loc) · 2.16 KB
/
Makefile
File metadata and controls
78 lines (59 loc) · 2.16 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
# Variables
PROJECT = aintelope
TESTS = tests
CODEBASE = ${PROJECT} ${TESTS}
VENV = venv_$(PROJECT)
run-training-baseline: ## run baseline experiment
python -m ${PROJECT} hparams.agent_id=example_agent
run-pipeline: ## run pipeline
python -m ${PROJECT} hparams.agent_id=example_agent
# ---------- installation and environment ----------
.PHONY: venv clean-venv install install-dev install-all build-local
venv: ## create virtual environment
@if [ ! -f "$(VENV)/bin/activate" ]; then python3 -m venv $(VENV) ; fi;
venv-310: ## create virtual environment
@if [ ! -f "$(VENV)/bin/activate" ]; then python3.10 -m venv $(VENV) ; fi;
clean-venv: ## remove virtual environment
if [ -d $(VENV) ]; then rm -r $(VENV) ; fi;
install: ## Install packages
# cat supresses error that grep generates when it does not find a match
pip uninstall -y ai_safety_gridworlds 2>&1 | grep -v "not installed" | cat
pip uninstall -y zoo_to_gym_multiagent_adapter 2>&1 | grep -v "not installed" | cat
pip install -r requirements/api.txt
install-dev: ## Install development packages
pip install -r requirements/dev.txt
install-all: install install-dev ## install all packages
# build-local: ## install the project locally
# pip install -e .
# ---------- testing ----------
.PHONY: tests-local
tests-local: ## Run tests locally
python -m pytest --tb=native --cov=$(CODEBASE)
# ---------- type checking ----------
.PHONY: typecheck-local
typecheck-local: ## Local typechecking
mypy $(CODEBASE)
# ---------- formatting ----------
.PHONY: isort isort-check format format-check
format: ## apply automatic code formatter to repository
black --exclude="aintelope_savanna.py" $(CODEBASE)
format-check: ## check formatting
black --check --exclude="aintelope_savanna.py" $(CODEBASE)
isort: ## Sort python imports
isort $(CODEBASE)
isort-check: ## check import order
isort --check $(CODEBASE)
# ---------- linting ----------
.PHONY: flake8
flake8: ## check code style
flake8 $(CODEBASE)
# ---------- cleaning ----------
.PHONY: clean
clean:
rm -rf *.egg-info
rm -rf .mypy_cache
rm -rf .pytest_cache
# ---------- help ----------
.PHONY: help
help: ## Show this help
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST)