forked from huggingface/huggingface_hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (57 loc) · 2.19 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
.PHONY: contrib quality style test
check_dirs := contrib src tests utils setup.py
quality:
ruff check $(check_dirs) # linter
ruff format --check $(check_dirs) # formatter
python utils/check_inference_input_params.py
python utils/check_contrib_list.py
python utils/check_static_imports.py
python utils/generate_async_inference_client.py
mypy src
style:
ruff format $(check_dirs) # formatter
ruff check --fix $(check_dirs) # linter
python utils/check_contrib_list.py --update
python utils/check_static_imports.py --update
python utils/generate_async_inference_client.py --update
inference_types_check:
python utils/generate_inference_types.py
inference_types_update:
python utils/generate_inference_types.py --update
repocard:
python utils/push_repocard_examples.py
test:
pytest ./tests/
# Taken from https://stackoverflow.com/a/12110773
# Commands:
# make contrib_setup_timm : setup tests for timm
# make contrib_test_timm : run tests for timm
# make contrib_timm : setup and run tests for timm
# make contrib_clear_timm : delete timm virtual env
#
# make contrib_setup : setup ALL tests
# make contrib_test : run ALL tests
# make contrib : setup and run ALL tests
# make contrib_clear : delete all virtual envs
# Use -j4 flag to run jobs in parallel.
CONTRIB_LIBS := sentence_transformers spacy timm
CONTRIB_JOBS := $(addprefix contrib_,${CONTRIB_LIBS})
CONTRIB_CLEAR_JOBS := $(addprefix contrib_clear_,${CONTRIB_LIBS})
CONTRIB_SETUP_JOBS := $(addprefix contrib_setup_,${CONTRIB_LIBS})
CONTRIB_TEST_JOBS := $(addprefix contrib_test_,${CONTRIB_LIBS})
contrib_clear_%:
rm -rf contrib/$*/.venv
contrib_setup_%:
python3 -m venv contrib/$*/.venv
./contrib/$*/.venv/bin/pip install -r contrib/$*/requirements.txt
./contrib/$*/.venv/bin/pip uninstall -y huggingface_hub
./contrib/$*/.venv/bin/pip install -e .[testing]
contrib_test_%:
./contrib/$*/.venv/bin/python -m pytest contrib/$*
contrib_%:
make contrib_setup_$*
make contrib_test_$*
contrib: ${CONTRIB_JOBS};
contrib_clear: ${CONTRIB_CLEAR_JOBS}; echo "Successful contrib tests."
contrib_setup: ${CONTRIB_SETUP_JOBS}; echo "Successful contrib setup."
contrib_test: ${CONTRIB_TEST_JOBS}; echo "Successful contrib tests."