-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 1.47 KB
/
Makefile
File metadata and controls
42 lines (33 loc) · 1.47 KB
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
.PHONY: setup_pre_commit run_pre-commit run_unit_tests run_ruff run_pyrefly clean help bump
INIT_PY := squawk_alembic/__init__.py
# This trick comes from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
setup_pre_commit: ## Setup pre-commit hooks
@poetry run pre-commit install
run_pre-commit: ## Run pre-commit hooks
@poetry run pre-commit run --all-files
run_unit_tests: ## Run unit tests
@poetry run pytest tests/ -v
run_ruff: ## Run ruff, the Python linter and code formatter
@poetry run ruff check . --fix
@poetry run ruff format .
run_pyrefly: ## Run pyrefly, a static type checker for Python
@poetry run pyrefly check
clean: ## Clean up the project (e.g., remove cache files)
@find . -type f -name '*.pyc' -delete
@find . -type d -name '__pycache__' -delete
bump: ## Bump version (usage: make bump VERSION=0.2.0)
ifndef VERSION
$(error Usage: make bump VERSION=0.2.0)
endif
@echo "Bumping version to $(VERSION)"
@if ! echo "$(VERSION)" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \
echo "Error: VERSION must be in semver format (e.g. 0.2.0)"; \
exit 1; \
fi
sed -i.bak 's/^version = ".*"/version = "$(VERSION)"/' pyproject.toml
rm -f pyproject.toml.bak
sed -i.bak 's/^__version__ = ".*"/__version__ = "$(VERSION)"/' $(INIT_PY)
rm -f $(INIT_PY).bak
@echo "Updated pyproject.toml and $(INIT_PY) to $(VERSION)"