forked from RasaHQ/rasa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 2.63 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
.PHONY: clean test lint init check-readme
JOBS ?= 1
help:
@echo " clean"
@echo " Remove Python/build artifacts."
@echo " formatter"
@echo " Apply black formatting to code."
@echo " lint"
@echo " Lint code with flake8, and check if black formatter should be applied."
@echo " types"
@echo " Check for type errors using pytype."
@echo " prepare-tests-ubuntu"
@echo " Install system requirements for running tests on Ubuntu and Debian based systems."
@echo " prepare-tests-macos"
@echo " Install system requirements for running tests on macOS."
@echo " prepare-tests-files"
@echo " Download all additional project files needed to run tests."
@echo " test"
@echo " Run pytest on tests/."
@echo " check-readme"
@echo " Check if the README can be converted from .md to .rst for PyPI."
@echo " doctest"
@echo " Run all doctests embedded in the documentation."
@echo " livedocs"
@echo " Build the docs locally."
clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
rm -rf build/
rm -rf .pytype/
rm -rf dist/
rm -rf docs/_build
formatter:
black rasa tests
lint:
flake8 rasa tests
black --check rasa tests
types:
pytype --keep-going rasa
prepare-tests-macos: prepare-tests-files
brew install graphviz wget
prepare-tests-ubuntu: prepare-tests-files
sudo apt-get -y install graphviz graphviz-dev python3-tk
prepare-tests-files:
pip3 install https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.1.0/en_core_web_md-2.1.0.tar.gz#egg=en_core_web_md==2.1.0 --no-cache-dir -q
python -m spacy link en_core_web_md en --force
pip3 install https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-2.1.0/de_core_news_sm-2.1.0.tar.gz#egg=de_core_news_sm==2.1.0 --no-cache-dir -q
python -m spacy link de_core_news_sm de --force
wget --progress=dot:giga -N -P data/ https://s3-eu-west-1.amazonaws.com/mitie/total_word_feature_extractor.dat
test: clean get-num-jobs
# OMP_NUM_THREADS can improve overral performance using one thread by process (on tensorflow), avoiding overload
OMP_NUM_THREADS=1 pytest tests -n $(JOBS) --cov rasa
get-num-jobs:
$(eval JOBS := $(if $(findstring -j, $(MAKEFLAGS)), $(shell echo $(MAKEFLAGS) | sed -E "s@.*-j([0-9]+).*@\1@"), $(JOBS)))
$(eval JOBS := $(if $(findstring -j, $(JOBS)), auto, $(JOBS)))
doctest: clean
cd docs && make doctest
livedocs:
cd docs && make livehtml
# if this runs through we can be sure the readme is properly shown on pypi
check-readme:
python setup.py check --restructuredtext --strict