-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
52 lines (38 loc) · 1.14 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
# project settings
PROJECT_PATH := faster_sam
# venv settings
export VIRTUALENV := $(PWD)/.venv
export PATH := $(VIRTUALENV)/bin:$(PATH)
# fix make < 3.81 (macOS and old Linux distros)
ifeq ($(filter undefine,$(value .FEATURES)),)
SHELL = env PATH="$(PATH)" /bin/bash
endif
.PHONY: .venv docs
build:
python -m build
.venv:
python -m venv $(VIRTUALENV)
pip install --upgrade pip
clean:
rm -rf .pytest_cache .coverage dist .mypy_cache *.egg-info
find $(PROJECT_PATH) -name __pycache__ | xargs rm -rf
find tests -name __pycache__ | xargs rm -rf
install-hook:
echo "make lint" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
install-dev: .venv install-hook
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
lint:
black --line-length=100 --target-version=py312 --check .
flake8 --max-line-length=100 --exclude .venv
format:
black --line-length=100 --target-version=py312 .
test:
coverage run --source=$(PROJECT_PATH) -m unittest -b
coverage: test .coverage
coverage report -m --fail-under=90
check:
twine check dist/*
docs:
sphinx-apidoc -feMT -o docs/ faster_sam
sphinx-build -M html docs/ docs/_build