-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
87 lines (72 loc) · 2.13 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
VENV = .venv
BIN = $(VENV)/bin
PYTHON = $(BIN)/python
PIP = $(BIN)/pip
TEST = pytest
# Self documenting commands
.DEFAULT_GOAL := help
.PHONY: help
help: ## show this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%s\033[0m|%s\n", $$1, $$2}' \
| column -t -s '|'
$(VENV)/bin/activate: requirements.txt
python3 -m venv .venv
$(PIP) install -U pip
$(PIP) install -r requirements.txt
clean: ## Remove temporary files
@rm -rf .ipynb_checkpoints
@rm -rf **/.ipynb_checkpoints
@rm -rf __pycache__
@rm -rf **/__pycache__
@rm -rf **/**/__pycache__
@rm -rf .pytest_cache
@rm -rf **/.pytest_cache
@rm -rf .ruff_cache
@rm -rf .coverage
@rm -rf build
@rm -rf dist
@rm -rf *.egg-info
@rm -rf pg_upsert.log
@rm -rf site/
bump: ## Show the next version
@bump-my-version show-bump
bump-patch: $(VENV)/bin/activate ## Bump patch version
@printf "Applying patch bump\n"
@$(BIN)/bump-my-version bump patch
@$(MAKE) bump
bump-minor: $(VENV)/bin/activate ## Bump minor version
@printf "Applying minor bump\n"
@$(BIN)/bump-my-version bump minor
@$(MAKE) bump
bump-major: $(VENV)/bin/activate ## Bump major version
@printf "Applying major bump\n"
@$(BIN)/bump-my-version bump major
@$(MAKE) bump
update: $(VENV)/bin/activate ## Update pip and pre-commit
$(PIP) install -U pip
$(PYTHON) -m pre_commit autoupdate
lint: $(VENV)/bin/activate ## Run pre-commit hooks
$(PYTHON) -m pre_commit install --install-hooks
$(PYTHON) -m pre_commit run --all-files
test: $(VENV)/bin/activate ## Run unit tests
$(PYTHON) -m $(TEST)
build-dist: $(VENV)/bin/activate ## Generate distrubition packages
$(PYTHON) -m build
build-docs: $(VENV)/bin/activate ## Generate documentation
@printf "Building documentation\n"
@rm -rf site/
@mkdocs build -c -q
preview-docs: $(VENV)/bin/activate ## Serve documentation
@mkdocs serve -w .
publish: $(VENV)/bin/activate ## Publish to PyPI
$(MAKE) lint
$(MAKE) test
$(MAKE) build-dist
$(PYTHON) -m twine upload --repository pypi dist/*
$(MAKE) clean
build: $(VENV)/bin/activate ## Build the project
$(MAKE) lint
$(MAKE) test
$(MAKE) build-dist
$(MAKE) build-docs