-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
49 lines (45 loc) · 1.44 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
SHELL := /usr/bin/env bash
EXEC = python=3.10
PACKAGE = probsem
INSTALL = python -m pip install
ACTIVATE = source activate $(PACKAGE)
.DEFAULT_GOAL := help
## help : print available build commands.
.PHONY : help
help : Makefile
@sed -n 's/^##//p' $<
## update : update repo with latest version from GitHub.
.PHONY : update
update :
@git pull origin main
## env : setup environment and install dependencies.
.PHONY : env
env : $(PACKAGE).egg-info/
$(PACKAGE).egg-info/ : setup.py requirements.txt
@conda create -yn $(PACKAGE) $(EXEC)
@$(ACTIVATE) ; $(INSTALL) -r requirements.txt ; $(INSTALL) -e ".[test]"
## test : run testing pipeline.
.PHONY : test
test : mypy pylint pytest
mypy : env html/mypy/index.html
pylint : env html/pylint/index.html
pytest : env html/coverage/index.html
html/mypy/index.html : $(PACKAGE)/*.py
@$(ACTIVATE) ; mypy \
-p $(PACKAGE) \
--ignore-missing-imports \
--html-report $(@D)
html/pylint/index.html : html/pylint/index.json
@$(ACTIVATE) ; pylint-json2html -o $@ -e utf-8 $<
html/pylint/index.json : $(PACKAGE)/*.py
@mkdir -p $(@D)
@$(ACTIVATE) ; pylint $(PACKAGE) \
--disable C0114,C0115,C0116 \
--generated-members torch.* \
--output-format=colorized,json:$@ \
|| pylint-exit $$?
html/coverage/index.html : html/pytest/report.html
@$(ACTIVATE) ; coverage html -d $(@D)
html/pytest/report.html : $(PACKAGE)/*.py test/*.py
@$(ACTIVATE) ; coverage run --branch -m pytest \
--html=$@ --self-contained-html