-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMake.rules
More file actions
64 lines (49 loc) · 2.38 KB
/
Copy pathMake.rules
File metadata and controls
64 lines (49 loc) · 2.38 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- Mode: Makefile -*-
PYTHON_VERSION := 3.13.12
UV_RUN := uv run
.git/hooks/pre-commit .git/hooks/pre-push: .venv
@$(UV_RUN) pre-commit install
@echo "pre-commit hooks installed!"
@touch .git/hooks/pre-commit .git/hooks/pre-push
$(ROOT_DIR)/.venv: pyproject.toml uv.lock
@uv sync --python $(PYTHON_VERSION)
@touch $@
clean:: ## Swab the decks! Does not touch docker images or volumes.
@find $(ROOT_DIR) -name \*~ -exec rm '{}' +
@find $(ROOT_DIR) -name \*.pyc -exec rm '{}' +
@find $(ROOT_DIR) -name __pycache__ -prune -exec rm -fr '{}' +
@find $(ROOT_DIR) -name .mypy_cache -prune -exec rm -fr '{}' +
@rm -rf build bdist cover dist sdist distribute-* *.egg *.egg-info
@rm -rf node_modules
@rm -rf *.tar.gz junit.xml coverage.xml .cache
@rm -rf .tox .eggs .ruff_formatted .ruff_cache
@rm -rf venv* .venv
@find $(ROOT_DIR) \( -name \*.orig -o -name \*.bak -o -name \*.rej \) -exec rm '{}' +
@mkdir -p .mypy_cache
.venv:: $(ROOT_DIR)/.venv
# Set the Make variable `VERSION` to the version of our project
version: .venv
$(eval VERSION := $(shell $(UV_RUN) hatch version))
@echo "Version: $(VERSION)"
# Squeegee vs lint targets. `lint` is pre-commit, so it does what you
# need done for the pre-commit hook to pass. Squeegee runs the various
# linting and formatting commands directly. It also runs mypy.
#
squeegee: .venv ruff-format mypy ## Manually run ruff format, mypy, and ruff check over all project files
@$(UV_RUN) ruff check $(ROOT_DIR)/asimap/ $(ROOT_DIR)/scripts/
lint: .venv .git/hooks/pre-commit ## Run all pre-commit hooks. Note: this only runs over files in the git repo (and staged files)
@$(UV_RUN) pre-commit run -a
PY_FILES=$(shell find $(ROOT_DIR)/asimap/ $(ROOT_DIR)/scripts/ -type f -name '*.py' 2>/dev/null)
JS_FILES=$(shell find $(ROOT_DIR)/asimap/ $(ROOT_DIR)/scripts/ -type f -name '*.js' 2>/dev/null)
.ruff_formatted: $(PY_FILES) .venv
@$(UV_RUN) ruff format $(ROOT_DIR)/asimap/ $(ROOT_DIR)/scripts/
@touch .ruff_formatted
.prettier: $(JS_FILES)
@npx prettier --write $(ROOT_DIR)/asimap
@touch .prettier
formatting: ruff-format prettier ## Run `ruff format`, `prettier` over all files in project.
ruff-format: .ruff_formatted ## Run `ruff format` over all Python files
prettier: .prettier
mypy: .venv ## Run `mypy` over `asimap/`
@$(UV_RUN) mypy --install-types --non-interactive --explicit-package-bases ./asimap/
.PHONY: formatting lint squeegee ruff-format mypy version