-
Notifications
You must be signed in to change notification settings - Fork 437
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (45 loc) · 1.65 KB
/
Makefile
File metadata and controls
53 lines (45 loc) · 1.65 KB
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
BUILDDIR := $(PWD)
CHECKDIRS := src tests examples setup.py
DOCDIR := docs
BUILD_ARGS := # set nightly to build nightly release
# refer to setup.py for allowed values for BUILD_TYPE
BUILD_TYPE?=dev
export BUILD_TYPE
TARGETS := "" # targets for running pytests: deepsparse,keras,onnx,pytorch,pytorch_models,export,pytorch_datasets,tensorflow_v1,tensorflow_v1_models,tensorflow_v1_datasets
PYTEST_ARGS ?= ""
ifneq ($(findstring transformers,$(TARGETS)),transformers)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/llmcompressor/transformers
endif
ifneq ($(findstring pytorch,$(TARGETS)),pytorch)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/llmcompressor/pytorch
endif
ifneq ($(findstring examples,$(TARGETS)),examples)
PYTEST_ARGS := $(PYTEST_ARGS) --ignore tests/examples
endif
# run checks on all files for the repo
# leaving out mypy src for now
quality:
@echo "Running python quality checks";
ruff check $(CHECKDIRS);
ruff format --check $(CHECKDIRS);
# style the code according to accepted standards for the repo
# Note: We run `ruff format` twice. Once to fix long lines before lint check
# and again to fix any formatting issues introduced by ruff check --fix
style:
@echo "Running python styling";
ruff format $(CHECKDIRS);
ruff check --fix $(CHECKDIRS);
ruff format --silent $(CHECKDIRS);
# run tests for the repo
test:
@echo "Running python tests";
pytest -ra tests $(PYTEST_ARGS) --ignore tests/lmeval
# creates wheel file
.PHONY: build
build:
python3 setup.py sdist bdist_wheel $(BUILD_ARGS)
# clean package
clean:
rm -fr .pytest_cache;
rm -fr docs/_build docs/build;
find $(CHECKDIRS) | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -fr;