-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
63 lines (50 loc) · 2.1 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
PACKAGE ?= whistle
PYTHON ?= $(shell which python || echo python)
PYTHON_BASENAME ?= $(shell basename $(PYTHON))
PYTHON_DIRNAME ?= $(shell dirname $(PYTHON))
PYTHON_REQUIREMENTS_FILE ?= requirements.txt
PYTHON_REQUIREMENTS_INLINE ?=
PYTHON_REQUIREMENTS_DEV_FILE ?= requirements-dev.txt
PYTHON_REQUIREMENTS_DEV_INLINE ?=
QUICK ?=
PIP ?= $(PYTHON) -m pip
PIP_INSTALL_OPTIONS ?=
POETRY ?= $(shell which poetry || echo poetry)
VERSION ?= $(shell git describe 2>/dev/null || git rev-parse --short HEAD)
PYTEST_OPTIONS ?= --capture=no --cov=$(PACKAGE) --cov-report html
SPHINX_BUILD ?= $(PYTHON_DIRNAME)/sphinx-build
SPHINX_OPTIONS ?=
SPHINX_SOURCEDIR ?= docs
SPHINX_BUILDDIR ?= $(SPHINX_SOURCEDIR)/_build
YAPF ?= $(PYTHON) -m yapf
YAPF_OPTIONS ?= -rip
.PHONY: $(SPHINX_SOURCEDIR) clean clean-dist apidoc format help install install-dev release test benchmarks qa
install: ## Installs the project.
$(POETRY) install --only main
install-dev: ## Installs the project (with dev dependencies).
$(POETRY) install
wheel:
mkdir -p dist
bin/sandbox "$(MAKE) install-dev; $(POETRY) build; cp dist/* $(PWD)/dist"
clean: clean-dist ## Cleans up the working copy.
find . -name __pycache__ -type d | xargs rm -rf
clean-dist: ## Cleans up the distribution files (wheels...)
rm -rf build dist *.egg-info
apidoc: ## Generate api doc
rm -rf docs/reference;
$(POETRY) run bin/generate_apidoc
test: install-dev ## Runs the test suite.
$(POETRY) run pytest $(PYTEST_OPTIONS) --benchmark-disable tests
benchmarks: install-dev ## Runs the benchmark suite.
$(PYTEST) $(PYTEST_OPTIONS) --benchmark-only tests
qa: clean apidoc format test benchmarks
$(SPHINX_SOURCEDIR): install-dev ##
$(SPHINX_BUILD) -b html -D latex_paper_size=a4 $(SPHINX_OPTIONS) $(SPHINX_SOURCEDIR) $(SPHINX_BUILDDIR)/html
format: install-dev ## Reformats the whole python codebase using isort and black.
isort whistle tests
black whistle tests
help: ## Shows available commands.
@echo "Available commands:"
@echo
@grep -E '^[a-zA-Z_-]+:.*?##[\s]?.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?##"}; {printf " make \033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo