forked from neuralmagic/sparsify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (63 loc) · 2.48 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
.PHONY: build docs test
BUILDDIR := $(PWD)
BUILD_ARGS := # set nightly to build nightly release
PYCHECKDIRS := examples tests src utils scripts setup.py
PYCHECKGLOBS := 'examples/**/*.py' 'scripts/**/*.py' 'src/**/*.py' 'tests/**/*.py' 'utils/**/*.py' setup.py
JSCHECKDIRS := src public
JSCHECKGLOBS := 'public/**/*.html' 'public/**/*.js' 'public/**/*.css' 'src/**/*.html' 'src/**/*.jsx' 'tests/**/*.jsx'
DOCDIR := docs
MDCHECKGLOBS := 'docs/**/*.md' 'docs/**/*.rst' 'examples/**/*.md' 'notebooks/**/*.md' 'scripts/**/*.md'
MDCHECKFILES := CODE_OF_CONDUCT.md CONTRIBUTING.md DEVELOPING.md README.md
SPARSEZOO_TEST_MODE := "true"
# run checks on all files for the repo
quality:
@echo "Running copyright checks";
python utils/copyright.py quality $(PYCHECKGLOBS) $(JSCHECKGLOBS) $(MDCHECKGLOBS) $(MDCHECKFILES)
@echo "Running python quality checks";
black --check $(PYCHECKDIRS);
isort --check-only $(PYCHECKDIRS);
flake8 $(PYCHECKDIRS);
@echo "Running js/jsx quality checks";
yarn prettier --check $(JSCHECKDIRS);
# style the code according to accepted standards for the repo
style:
@echo "Running copyrighting";
python utils/copyright.py style $(PYCHECKGLOBS) $(JSCHECKGLOBS) $(MDCHECKGLOBS) $(MDCHECKFILES)
@echo "Running python styling";
black $(PYCHECKDIRS);
isort $(PYCHECKDIRS);
@echo "Running js/jsx styling";
yarn prettier --write $(JSCHECKDIRS);
# run tests for the repo
test:
@echo "Running python tests";
@pytest;
# create docs
docs:
@echo "Running docs creation";
export SPARSEML_IGNORE_TFV1="True"; \
python utils/docs_builder.py --src $(DOCDIR) --dest $(DOCDIR)/build/html && \
cp -r $(DOCDIR)/source/userguide/images/ $(DOCDIR)/build/html/images/ && \
cp -r $(DOCDIR)/source/userguide/images/ $(DOCDIR)/build/html/_images/ && \
cp -r $(DOCDIR)/source/userguide/images/ $(DOCDIR)/build/html/source/userguide/images/;
docsupdate:
@echo "Runnning update to api docs";
find $(DOCDIR)/api | grep .rst | xargs rm -rf;
export SPARSEML_IGNORE_TFV1="True"; sphinx-apidoc -o "$(DOCDIR)/api" src/sparsify;
# creates wheel file
build:
@echo "Building UI";
yarn install;
yarn run build;
mv -v build/* src/sparsify/ui/;
@echo "Building python package";
python3 setup.py sdist bdist_wheel $(BUILD_ARGS);
# clean package
clean:
rm -rf .pytest_cache;
rm -rf docs/_build docs/build;
rm -rf build;
rm -rf dist;
find src/sparsify/ui/* | grep -v .gitkeep | xargs rm -rf;
rm -rf src/sparsify.egg-info;
find $(PYCHECKDIRS) $(JSCHECKDIRS) | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf;