forked from RasaHQ/rasa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
148 lines (124 loc) · 4.81 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
.PHONY: clean test lint init docs
JOBS ?= 1
help:
@echo "make"
@echo " clean"
@echo " Remove Python/build artifacts."
@echo " install"
@echo " Install rasa."
@echo " install-full"
@echo " Install rasa with all extras (transformers, tensorflow_text, spacy, jieba)."
@echo " formatter"
@echo " Apply black formatting to code."
@echo " lint"
@echo " Lint code with flake8, and check if black formatter should be applied."
@echo " lint-docstrings"
@echo " Check docstring conventions in changed files."
@echo " types"
@echo " Check for type errors using mypy."
@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-windows"
@echo " Install system requirements for running tests on Windows."
@echo " prepare-tests-files"
@echo " Download all additional project files needed to run tests."
@echo " test"
@echo " Run pytest on tests/."
@echo " Use the JOBS environment variable to configure number of workers (default: 1)."
@echo " livedocs"
@echo " Build the docs locally."
@echo " release"
@echo " Prepare a release."
clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
rm -rf build/
rm -rf .mypy_cache/
rm -rf dist/
rm -rf docs/build
rm -rf docs/.docusaurus
install:
poetry run python -m pip install -U pip
poetry install
install-mitie:
poetry run python -m pip install -U git+https://github.com/tmbo/MITIE.git#egg=mitie
install-full: install install-mitie
poetry install -E full
install-docs:
cd docs/ && yarn install
formatter:
poetry run black rasa tests
lint:
# Ignore docstring errors when running on the entire project
poetry run flake8 rasa tests --extend-ignore D
poetry run black --check rasa tests
make lint-docstrings
BRANCH ?= master # Compare against `master` if no branch was provided
lint-docstrings:
# Lint docstrings only against the the diff to avoid too many errors.
# Check only production code. Ignore other flake errors which are captured by `lint`
git diff $(BRANCH) -- rasa | poetry run flake8 --select D --diff
types:
# FIXME: working our way towards removing these
# see https://github.com/RasaHQ/rasa/pull/6470
# the list below is sorted by the number of errors for each error code, in decreasing order
poetry run mypy rasa --disable-error-code arg-type \
--disable-error-code assignment \
--disable-error-code var-annotated \
--disable-error-code return-value \
--disable-error-code union-attr \
--disable-error-code override \
--disable-error-code operator \
--disable-error-code attr-defined \
--disable-error-code index \
--disable-error-code misc \
--disable-error-code return \
--disable-error-code call-arg \
--disable-error-code type-var \
--disable-error-code list-item \
--disable-error-code has-type \
--disable-error-code valid-type \
--disable-error-code dict-item \
--disable-error-code no-redef \
--disable-error-code func-returns-value
prepare-tests-files:
poetry install -E spacy
poetry run python -m spacy download en_core_web_md
poetry run python -m spacy download de_core_news_sm
poetry run python -m spacy link en_core_web_md en --force
poetry run 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
prepare-wget-macos:
brew install wget || true
prepare-wget-windows:
choco install wget
prepare-tests-macos: prepare-wget-macos prepare-tests-files
brew install graphviz || true
prepare-tests-ubuntu: prepare-tests-files
sudo apt-get -y install graphviz graphviz-dev python-tk
prepare-tests-windows: prepare-wget-windows prepare-tests-files
choco install graphviz
test: clean
# OMP_NUM_THREADS can improve overall performance using one thread by process (on tensorflow), avoiding overload
OMP_NUM_THREADS=1 poetry run pytest tests -n $(JOBS) --cov rasa
generate-pending-changelog:
poetry run python -c "from scripts import release; release.generate_changelog('major.minor.patch')"
cleanup-generated-changelog:
# this is a helper to cleanup your git status locally after running "make test-docs"
# it's not run on CI at the moment
git status --porcelain | sed -n '/^D */s///p' | xargs git reset HEAD
git reset HEAD CHANGELOG.mdx
git ls-files --deleted | xargs git checkout
git checkout CHANGELOG.mdx
test-docs: generate-pending-changelog docs
poetry run pytest tests/docs/*
cd docs && yarn mdx-lint
docs:
cd docs/ && poetry run yarn pre-build && yarn build
livedocs:
cd docs/ && poetry run yarn start
release:
poetry run python scripts/release.py