-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
94 lines (77 loc) · 2.27 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
88
89
90
91
92
93
94
VENV = .venv
BIN = $(VENV)/bin
PYTHON = $(BIN)/python
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 '|'
$(BIN)/activate: requirements.txt
uv venv
source $(BIN)/activate && uv pip install -r requirements.txt
init: ## Initialize the project environment (venv & pre-commit)
@$(MAKE) $(BIN)/activate
@$(MAKE) update
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 site/
@rm -rf .mypy_cache
@rm -rf **/**/*.xlsx
@rm -rf **/**/*.sqlite
bump: ## Show the next version
@bump-my-version show-bump
bump-patch: $(BIN)/activate ## Bump patch version
@printf "Applying patch bump\n"
@$(BIN)/bump-my-version bump patch
@$(MAKE) bump
bump-minor: $(BIN)/activate ## Bump minor version
@printf "Applying minor bump\n"
@$(BIN)/bump-my-version bump minor
@$(MAKE) bump
bump-major: $(BIN)/activate ## Bump major version
@printf "Applying major bump\n"
@$(BIN)/bump-my-version bump major
@$(MAKE) bump
update: $(BIN)/activate ## Update pre-commit hooks
$(PYTHON) -m pre_commit autoupdate
lint: $(BIN)/activate ## Run pre-commit hooks
$(PYTHON) -m pre_commit install --install-hooks
$(PYTHON) -m pre_commit run --all-files
test: $(BIN)/activate ## Run unit tests
$(PYTHON) -m $(TEST)
build-dist: $(BIN)/activate ## Generate distribution packages
$(PYTHON) -m build
build-docker: ## Build the docker image
@docker build -t crosstab .
build-docs: $(BIN)/activate ## Generate documentation
@printf "Building documentation\n"
@mkdocs build -c -q
@open site/index.html
preview-docs: $(BIN)/activate ## Serve documentation
@mkdocs serve -w .
publish: $(BIN)/activate ## Publish to PyPI
$(MAKE) lint
$(MAKE) test
$(MAKE) build-dist
$(PYTHON) -m twine upload --repository pypi dist/*
$(MAKE) clean
build: $(BIN)/activate ## Build the project
$(MAKE) lint
$(MAKE) test
$(MAKE) build-dist
$(MAKE) build-docker
$(MAKE) build-docs