-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
executable file
·72 lines (59 loc) · 1.88 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
# from https://github.com/alexander-beedie/polars/blob/a083a26ca092b3821bf4044aed74d91ee127bad1/py-polars/Makefile
.DEFAULT_GOAL := help
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
PYTHONPATH=
VENV = .venv
MAKE = make
VENV_BIN=$(VENV)/bin
.venv: ## Set up virtual environment and install requirements
python3 -m venv $(VENV)
$(MAKE) requirements
.PHONY: requirements
requirements: .venv ## Install/refresh all project requirements
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/pip install -r requirements-dev.txt
$(VENV_BIN)/pip install -r requirements.txt
.PHONY: build
build: .venv ## Compile and install retriv
. $(VENV_BIN)/activate
.PHONY: fix-lint
fix-lint: .venv ## Fix linting
. $(VENV_BIN)/activate
$(VENV_BIN)/black .
$(VENV_BIN)/isort .
.PHONY: lint
lint: .venv ## Check linting
. $(VENV_BIN)/activate
$(VENV_BIN)/isort --check .
$(VENV_BIN)/black --check .
$(VENV_BIN)/blackdoc .
$(VENV_BIN)/ruff .
$(VENV_BIN)/typos .
# $(VENV_BIN)/mypy retriv
.PHONY: test
test: .venv build ## Run unittest
. $(VENV_BIN)/activate
$(VENV_BIN)/pytest tests
.PHONY: coverage
coverage: .venv build ## Run tests and report coverage
. $(VENV_BIN)/activate
$(VENV_BIN)/pytest tests --cov -n auto --dist worksteal -m "not benchmark"
.PHONY: release
release: .venv build ## Release a new version
. $(VENV_BIN)/activate
$(VENV_BIN)/python setup.py sdist bdist_wheel
$(VENV_BIN)/twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: clean
clean: ## Clean up caches and build artifacts
@rm -rf .venv/
@rm -rf target/
@rm -rf .pytest_cache/
@rm -rf .coverage
@rm -rf retriv.egg-info
@rm -rf dist
@rm -rf build
.PHONY: help
help: ## Display this help screen
@echo -e "\033[1mAvailable commands:\033[0m\n"
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort