-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
52 lines (39 loc) · 1.53 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
.PHONY: docs eval
# set default shell
SHELL := $(shell which bash)
# src dirs and files
SRCDIRS = gptme tests scripts train eval
SRCFILES = $(shell find ${SRCDIRS} -name '*.py')
# exclude files
EXCLUDES = tests/output scripts/build_changelog.py
SRCFILES = $(shell find ${SRCDIRS} -name '*.py' $(foreach EXCLUDE,$(EXCLUDES),-not -path $(EXCLUDE)))
# Check if playwright is installed (for browser tests)
HAS_PLAYWRIGHT := $(shell poetry run command -v playwright 2> /dev/null)
build:
poetry install
test:
@# if SLOW is not set, pass `-m "not slow"` to skip slow tests
poetry run pytest ${SRCDIRS} -v --log-level INFO --durations=5 \
--cov=gptme --cov-report=xml --cov-report=term-missing --cov-report=html \
-n 8 \
$(if $(SLOW), --timeout 60, --timeout 5 -m "not slow") \
$(if $(EVAL), , -m "not eval") \
$(if $(PROFILE), --profile-svg) \
$(if $(HAS_PLAYWRIGHT), --cov-config=scripts/.coveragerc-playwright)
eval:
cd eval && poetry run python main.py
typecheck:
poetry run mypy --ignore-missing-imports ${SRCDIRS} $(if $(EXCLUDES),$(foreach EXCLUDE,$(EXCLUDES),--exclude $(EXCLUDE)))
lint:
poetry run ruff ${SRCDIRS}
format:
poetry run ruff --fix-only ${SRCDIRS}
poetry run pyupgrade --py310-plus --exit-zero-even-if-changed ${SRCFILES}
poetry run black ${SRCDIRS}
precommit: format lint typecheck test
docs:
poetry run make -C docs html
clean-test:
echo $$HOME/.local/share/gptme/logs/*test-*-test_*
rm -I $$HOME/.local/share/gptme/logs/*test-*-test_*/*.jsonl || true
rm --dir $$HOME/.local/share/gptme/logs/*test-*-test_*/ || true