handsomeboyMMk commited on
Commit
1a74260
·
1 Parent(s): e2b7296

Upload Makefile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Makefile +66 -0
Makefile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: contrib quality style test
2
+
3
+
4
+ check_dirs := contrib src tests utils setup.py
5
+
6
+
7
+ quality:
8
+ ruff check $(check_dirs) # linter
9
+ ruff format --check $(check_dirs) # formatter
10
+ mypy src
11
+ python utils/check_contrib_list.py
12
+ python utils/check_static_imports.py
13
+ python utils/generate_async_inference_client.py
14
+
15
+ style:
16
+ ruff check --fix $(check_dirs) # linter
17
+ ruff format $(check_dirs) # formatter
18
+ python utils/check_contrib_list.py --update
19
+ python utils/check_static_imports.py --update
20
+ python utils/generate_async_inference_client.py --update
21
+
22
+ repocard:
23
+ python utils/push_repocard_examples.py
24
+
25
+
26
+ test:
27
+ pytest ./tests/
28
+
29
+ # Taken from https://stackoverflow.com/a/12110773
30
+ # Commands:
31
+ # make contrib_setup_timm : setup tests for timm
32
+ # make contrib_test_timm : run tests for timm
33
+ # make contrib_timm : setup and run tests for timm
34
+ # make contrib_clear_timm : delete timm virtual env
35
+ #
36
+ # make contrib_setup : setup ALL tests
37
+ # make contrib_test : run ALL tests
38
+ # make contrib : setup and run ALL tests
39
+ # make contrib_clear : delete all virtual envs
40
+ # Use -j4 flag to run jobs in parallel.
41
+ CONTRIB_LIBS := sentence_transformers spacy timm
42
+ CONTRIB_JOBS := $(addprefix contrib_,${CONTRIB_LIBS})
43
+ CONTRIB_CLEAR_JOBS := $(addprefix contrib_clear_,${CONTRIB_LIBS})
44
+ CONTRIB_SETUP_JOBS := $(addprefix contrib_setup_,${CONTRIB_LIBS})
45
+ CONTRIB_TEST_JOBS := $(addprefix contrib_test_,${CONTRIB_LIBS})
46
+
47
+ contrib_clear_%:
48
+ rm -rf contrib/$*/.venv
49
+
50
+ contrib_setup_%:
51
+ python3 -m venv contrib/$*/.venv
52
+ ./contrib/$*/.venv/bin/pip install -r contrib/$*/requirements.txt
53
+ ./contrib/$*/.venv/bin/pip uninstall -y huggingface_hub
54
+ ./contrib/$*/.venv/bin/pip install -e .[testing]
55
+
56
+ contrib_test_%:
57
+ ./contrib/$*/.venv/bin/python -m pytest contrib/$*
58
+
59
+ contrib_%:
60
+ make contrib_setup_$*
61
+ make contrib_test_$*
62
+
63
+ contrib: ${CONTRIB_JOBS};
64
+ contrib_clear: ${CONTRIB_CLEAR_JOBS}; echo "Successful contrib tests."
65
+ contrib_setup: ${CONTRIB_SETUP_JOBS}; echo "Successful contrib setup."
66
+ contrib_test: ${CONTRIB_TEST_JOBS}; echo "Successful contrib tests."