-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (146 loc) · 4.41 KB
/
Copy pathMakefile
File metadata and controls
173 lines (146 loc) · 4.41 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
PYTHON ?= python3
VENV ?= .venv
UV ?= uv
PORT ?= 8218
HOST ?= 127.0.0.1
ifneq (,$(wildcard .env))
include .env
export
endif
.PHONY: help venv sync install install-dev install-control install-transports install-all \
test test-fast test-examples lint format check examples rest serve clean lock goal
help: ## Show targets
@echo "hillm — Hardware Interface LLM"
@echo ""
@echo "Setup:"
@echo " make sync uv sync (workspace + dev)"
@echo " make install editable core (pip fallback)"
@echo " make install-dev core + dev + control layer"
@echo " make install-control control packages only"
@echo " make install-transports optional serial/modbus/mqtt"
@echo " make install-all dev + all transports"
@echo " make lock regenerate uv.lock"
@echo ""
@echo "Run:"
@echo " make devices list hardware profiles"
@echo " make scan host hardware scan"
@echo " make health dsl2hillm HEALTH"
@echo " make rest start rest2hillm on :$(PORT)"
@echo ""
@echo "Test:"
@echo " make test full pytest suite"
@echo " make test-fast core + dsl tests"
@echo " make test-examples examples/**/*.sh"
@echo " make examples bash examples/run-all-dry-run.sh"
@echo " make check lint + test"
@echo ""
@echo "Release:"
@echo " make lint ruff check"
@echo " make format ruff format"
@echo " make clean build artifacts + caches"
@echo " make goal goal -a workflow"
venv:
@test -x "$(VENV)/bin/python" || $(PYTHON) -m venv "$(VENV)"
_has_uv := $(shell command -v $(UV) >/dev/null 2>&1 && echo 1)
sync:
ifneq ($(strip $(_has_uv)),)
$(UV) sync --all-packages --extra dev
else
$(MAKE) install-dev
endif
@echo "✓ hillm workspace ready"
install: venv
$(VENV)/bin/pip install -e .
@echo "✓ hillm core installed"
install-control: venv
bash packages/install-dev.sh
@echo "✓ control layer installed"
install-dev: venv
ifneq ($(strip $(_has_uv)),)
$(UV) sync --all-packages --extra dev
else
$(VENV)/bin/pip install -e ".[dev]"
bash packages/install-dev.sh
endif
@echo "✓ dev + control layer ready"
install-transports: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) sync --all-packages --extra dev --extra all-transports
else
$(VENV)/bin/pip install -e ".[all-transports]"
endif
@echo "✓ optional transports installed"
install-all: install-transports
@echo "✓ full hillm install"
lock:
$(UV) lock
@echo "✓ uv.lock updated"
test: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run pytest tests/ packages/dsl2hillm/tests packages/uri2hillm/tests -v --tb=short
else
$(VENV)/bin/pytest tests/ packages/dsl2hillm/tests packages/uri2hillm/tests -v --tb=short
endif
test-fast: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run pytest tests/test_hillm.py packages/dsl2hillm/tests -q --tb=short
else
$(VENV)/bin/pytest tests/test_hillm.py packages/dsl2hillm/tests -q --tb=short
endif
test-examples: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run pytest tests/test_examples.py -v --tb=short
else
$(VENV)/bin/pytest tests/test_examples.py -v --tb=short
endif
examples: install-dev
bash examples/run-all-dry-run.sh
devices: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run hillm devices
else
$(VENV)/bin/hillm devices
endif
scan: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run hillm scan
else
$(VENV)/bin/hillm scan
endif
health: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run dsl2hillm HEALTH
else
$(VENV)/bin/dsl2hillm HEALTH
endif
rest: install-dev
@echo "REST API: http://$(HOST):$(PORT)/health"
ifneq ($(strip $(_has_uv)),)
$(UV) run rest2hillm --host $(HOST) --port $(PORT)
else
$(VENV)/bin/rest2hillm --host $(HOST) --port $(PORT)
endif
serve: rest
lint: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run ruff check src packages/*/src
else
$(VENV)/bin/ruff check src packages/*/src
endif
format: install-dev
ifneq ($(strip $(_has_uv)),)
$(UV) run ruff format src packages/*/src
else
$(VENV)/bin/ruff format src packages/*/src
endif
check: lint test
clean:
rm -rf build/ dist/ .pytest_cache .coverage htmlcov/
rm -rf src/*.egg-info packages/*/*.egg-info packages/*/src/*.egg-info 2>/dev/null || true
find . -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true
find . -type f -name '*.pyc' -delete 2>/dev/null || true
@echo "✓ cleaned"
goal: install-dev
goal -a