-
Notifications
You must be signed in to change notification settings - Fork 743
/
Copy pathMakefile
103 lines (86 loc) · 3.71 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
ROOTDIR ?= $(realpath ..)
DOCKER ?= docker
DOCKER_IMG_NAME ?= interpretml/quickbuild:latest
DOCKER_VOL_NAME ?= interpretml-quickbuild
DOCKER_MNT_PATH ?= /mnt/interpret
DOCKER_CWD ?= /usr/staging/interpret
PYTHON ?= python
PIP ?= pip
NPM ?= npm
ifeq ($(OS),Windows_NT)
BUILD_NATIVE ?= $(ROOTDIR)/build.bat
MKDIR_P ?= mkdir
RMDIR ?= rmdir /Q /S
COPY ?= copy
TOUCH ?= echo.>
else
BUILD_NATIVE ?= $(ROOTDIR)/build.sh
MKDIR_P ?= mkdir -p
RMDIR ?= rm -rf
COPY ?= cp
TOUCH ?= touch
endif
docker: prepare-docker
$(DOCKER) run --rm -it -v $(ROOTDIR):$(DOCKER_MNT_PATH) -v $(DOCKER_VOL_NAME):$(DOCKER_CWD) \
-p 127.0.0.1:8888:8888 \
-p 127.0.0.1:7001:7001 \
-e INTERPRET_DOCKER_MODE='dev' \
--entrypoint /bin/sh $(DOCKER_IMG_NAME) -c "\
cd $(DOCKER_CWD)/python/interpret-core && pip install -e . &&\
cd $(DOCKER_CWD)/python/interpret && pip install -e . &&\
cd $(DOCKER_CWD)/scripts && /bin/bash"
run-docker-notebook: prepare-docker
$(DOCKER) run --rm -it -v $(ROOTDIR):$(DOCKER_MNT_PATH) -v $(DOCKER_VOL_NAME):$(DOCKER_CWD) \
-p 127.0.0.1:8888:8888 \
-p 127.0.0.1:7001:7001 \
-e INTERPRET_DOCKER_MODE='dev' \
--entrypoint /bin/bash $(DOCKER_IMG_NAME) -c "\
cd $(DOCKER_CWD)/python/interpret-core && pip install -e . &&\
cd $(DOCKER_CWD)/python/interpret && pip install -e . &&\
cd $(DOCKER_CWD)/examples/python/notebooks &&\
python -m jupyter notebook --ip=0.0.0.0 --allow-root"
build-in-docker: prepare-docker
$(DOCKER) run --rm -it -v $(ROOTDIR):$(DOCKER_MNT_PATH) -v $(DOCKER_VOL_NAME):$(DOCKER_CWD) \
--entrypoint /bin/bash $(DOCKER_IMG_NAME) -c "cd $(DOCKER_CWD)/scripts && make build"
prepare-docker:
$(DOCKER) build -t $(DOCKER_IMG_NAME) .
$(DOCKER) volume create --name $(DOCKER_VOL_NAME)
$(DOCKER) run --rm -it -v $(ROOTDIR):$(DOCKER_MNT_PATH) -v $(DOCKER_VOL_NAME):$(DOCKER_CWD) \
--entrypoint /bin/bash $(DOCKER_IMG_NAME) $(DOCKER_MNT_PATH)/scripts/mirror-repo-docker.sh $(DOCKER_CWD)
clean:
-$(RMDIR) "$(ROOTDIR)/bld"
-$(RMDIR) "$(ROOTDIR)/python/interpret-core/interpret/root/bld/lib"
-$(RMDIR) "$(ROOTDIR)/shared/vis/dist"
-$(DOCKER) volume rm $(DOCKER_VOL_NAME)
-$(DOCKER) image rm $(DOCKER_IMG_NAME)
install: build
-$(PIP) uninstall -y interpret
-$(PIP) uninstall -y interpret-core
cd $(ROOTDIR)/python/interpret-core && $(PIP) install -e .
cd $(ROOTDIR)/python/interpret && $(PIP) install -e .
install-core: build
-$(PIP) uninstall -y interpret
-$(PIP) uninstall -y interpret-core
cd $(ROOTDIR)/python/interpret-core && $(PIP) install -e .
build: build-wheel
build-wheel: build-javascript build-native
cd $(ROOTDIR)/python/interpret-core && $(PYTHON) setup.py bdist_wheel -d $(ROOTDIR)/bld/bdist
cd $(ROOTDIR)/python/interpret && $(PYTHON) setup.py bdist_wheel -d $(ROOTDIR)/bld/bdist
build-python:
cd $(ROOTDIR)/python/interpret-core && $(PYTHON) setup.py bdist_wheel -d $(ROOTDIR)/bld/bdist
cd $(ROOTDIR)/python/interpret && $(PYTHON) setup.py bdist_wheel -d $(ROOTDIR)/bld/bdist
build-javascript:
cd $(ROOTDIR)/shared/vis && $(NPM) install
cd $(ROOTDIR)/shared/vis && $(NPM) run build-prod
-$(MKDIR_P) "$(ROOTDIR)/python/interpret-core/interpret/root/bld/lib"
cd $(ROOTDIR)/shared/vis/dist && $(COPY) "interpret-inline.js" "$(ROOTDIR)/python/interpret-core/interpret/root/bld/lib/"
cd $(ROOTDIR)/shared/vis/dist && $(COPY) "interpret-inline.js.LICENSE.txt" "$(ROOTDIR)/python/interpret-core/interpret/root/bld/lib/"
build-native:
$(BUILD_NATIVE)
test: test-native test-javascript test-python
test-python:
cd $(ROOTDIR)/python/interpret-core && $(PYTHON) -m pytest -vv -n auto --runslow --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
test-javascript:
@echo JavaScript tests are not available.
test-native:
@echo Native tests are not yet connected.