-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
111 lines (90 loc) · 2.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
all: help
# --------------------------------------------
.PHONY: setup
setup: ## setup project with runtime dependencies
ifeq (,$(wildcard .init/setup))
@(which uv > /dev/null 2>&1) || \
(echo "smvp requires uv. See README for instructions."; exit 1)
@if [ ! -d "./scratch" ]; then \
mkdir -p scratch; \
fi
mkdir .init
touch .init/setup
uv sync --no-dev --frozen
else
@echo "Initial setup is already complete. If you are having issues, run:"
@echo
@echo "make reset"
@echo "make setup"
@echo
endif
# --------------------------------------------
.PHONY: dev
dev: ## add development dependencies (run make setup first)
ifneq (,$(wildcard .init/setup))
uv sync --frozen
@touch .init/dev
else
@echo "Please run \"make setup\" first"
endif
# --------------------------------------------
.PHONY: upgrade
upgrade: ## upgrade project dependencies
ifeq (,$(wildcard .init/dev))
uv sync --no-dev --upgrade
else
uv sync --upgrade
endif
# --------------------------------------------
.PHONY: sync
sync: ## sync dependencies with the lock file (use --frozen)
ifeq (,$(wildcard .init/setup))
@echo "Please run \"make setup\" first" ; exit 1
endif
ifneq (,$(wildcard .init/dev))
uv sync --frozen
else
uv sync --frozen --no-dev
endif
# --------------------------------------------
.PHONY: reset
reset: clean ## remove venv, artifacts, and init directory
@echo Resetting project state
rm -rf .init .ruff_cache .mypy_cache .venv
# --------------------------------------------
.PHONY: build
build: ## build package for publishing
rm -rf dist
uv build
# --------------------------------------------
.PHONY: publish-production
publish-production: build ## publish package to pypi.org for production
uv publish --publish-url https://upload.pypi.org/legacy/ \
--token ${PYPITOKEN}
# --------------------------------------------
.PHONY: publish-test
publish-test: build ## publish package to test.pypi.org for testing
uv publish --publish-url https://test.pypi.org/legacy/ \
--token ${TESTPYPITOKEN}
# --------------------------------------------
.PHONY: clean
clean: ## cleanup python runtime and build artifacts
@echo Cleaning python runtime and build artifacts
@rm -rf build/
@rm -rf dist/
@find . -type d -name __pycache__ -exec rm -rf {} \; -prune
@find . -type d -name .pytest_cache -exec rm -rf {} \; -prune
@find . -type d -name .eggs -exec rm -rf {} \; -prune
@find . -type d -name htmlcov -exec rm -rf {} \; -prune
@find . -type d -name *.egg-info -exec rm -rf {} \; -prune
@find . -type f -name *.egg -delete
@find . -type f -name *.pyc -delete
@find . -type f -name *.pyo -delete
@find . -type f -name *.coverage -delete
# --------------------------------------------
.PHONY: help
help: ## show help
@echo Please specify a target. Choices are:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk \
'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'