-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
372 lines (368 loc) · 11.4 KB
/
Taskfile.yml
File metadata and controls
372 lines (368 loc) · 11.4 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
version: '1'
name: prellm
description: Minimal Taskfile
variables:
APP_NAME: prellm
environments:
local:
container_runtime: docker
compose_command: docker compose
pipeline:
python_version: "3.12"
runner_image: ubuntu-latest
branches: [main]
cache: [~/.cache/pip]
artifacts: [dist/]
stages:
- name: lint
tasks: [lint]
- name: test
tasks: [test]
- name: build
tasks: [build]
when: "branch:main"
tasks:
install:
desc: Install Python dependencies (editable)
cmds:
- pip install -e .[dev]
test:
desc: Run pytest suite
cmds:
- pytest -q
lint:
desc: Run ruff lint check
cmds:
- ruff check .
fmt:
desc: Auto-format with ruff
cmds:
- ruff format .
build:
desc: Build wheel + sdist
cmds:
- python -m build
clean:
desc: Remove build artefacts
cmds:
- rm -rf build/ dist/ *.egg-info
up:
desc: Start services via docker compose
cmds:
- docker compose up -d
down:
desc: Stop services
cmds:
- docker compose down
logs:
desc: Tail compose logs
cmds:
- docker compose logs -f
ps:
desc: Show running compose services
cmds:
- docker compose ps
docker-build:
desc: Build docker image
cmds:
- docker build -t prellm:latest .
help:
desc: '[imported from Makefile] help'
cmds:
- echo "Prellm - LLM prompt middleware"
- echo "=================================="
- echo ""
- echo "Available commands:"
- echo " install Install production dependencies"
- echo " install-dev Install development dependencies"
- echo " config Interactive LLM configuration wizard"
- echo " doctor Check configuration and provider connectivity"
- echo " serve Start the preLLM API server"
- 'echo " query Run a test query (usage: make query Q=''hello world'')"'
- echo " test Run tests"
- echo " test-cov Run tests with coverage"
- echo " examples Run all example scripts (real-time demos)"
- echo " lint Run linting (ruff)"
- echo " format Format code (ruff)"
- echo " clean Clean build artifacts"
- echo " build Build package"
- echo " publish Publish to PyPI"
- echo " demo Run demo with sample config"
- echo " init Generate starter config"
- echo ""
fix-venv:
desc: '[imported from Makefile] fix-venv'
cmds:
- if [ -z "$(POETRY)" ]; then \
- if [ -d "venv" ]; then \
- echo "$(YELLOW)Checking venv health...$(NC)"; \
- if ! venv/bin/python --version >/dev/null 2>&1 || ! venv/bin/pip --version >/dev/null
2>&1; then \
- echo "$(RED)Broken venv detected. Recreating...$(NC)"; \
- rm -rf venv; \
- python3 -m venv venv; \
- . venv/bin/activate && python -m pip install --upgrade pip; \
- echo "$(GREEN)Venv recreated!$(NC)"; \
- fi; \
- else \
- echo "$(YELLOW)Creating venv...$(NC)"; \
- python3 -m venv venv; \
- . venv/bin/activate && python -m pip install --upgrade pip; \
- echo "$(GREEN)Venv created!$(NC)"; \
- fi; \
- fi
install-dev:
desc: '[imported from Makefile] install-dev'
cmds:
- if [ -z "$(POETRY)" ]; then \
- $(PIP) install -e ".[dev]"; \
- else \
- poetry lock 2>/dev/null || true; \
- poetry install; \
- fi
deps:
- fix-venv
test-cov:
desc: '[imported from Makefile] test-cov'
cmds:
- $(RUN) python -m pytest tests/ -v --cov=prellm --cov-report=html --cov-report=term
format:
desc: '[imported from Makefile] format'
cmds:
- $(RUN) ruff format .
publish:
desc: '[imported from Makefile] publish'
cmds:
- echo "$(YELLOW)Publishing to PyPI...$(NC)"
- $(PYTHON) -m twine upload dist/*
- echo "$(GREEN)Published to PyPI!$(NC)"
- 'echo "Install with: pip install prellm"'
publish-test:
desc: '[imported from Makefile] publish-test'
cmds:
- echo "$(YELLOW)Publishing to Test PyPI...$(NC)"
- $(PYTHON) -m twine upload --repository testpypi dist/*
- echo "$(GREEN)Published to Test PyPI!$(NC)"
bump-patch:
desc: '[imported from Makefile] bump-patch'
cmds:
- $(PYTHON) -m bumpver update --patch
check-twine:
desc: '[imported from Makefile] check-twine'
cmds:
- $(PYTHON) -c "import twine" >/dev/null 2>&1 || ( \
- echo "Missing twine. Installing twine..."; \
- $(PYTHON) -m pip install "twine>=4.0.0" >/dev/null; \
- $(PYTHON) -c "import twine" >/dev/null 2>&1 || (echo "Failed to install twine.";
exit 1); \
- )
check-build:
desc: '[imported from Makefile] check-build'
cmds:
- $(PYTHON) -c "import build" >/dev/null 2>&1 || ( \
- echo "Missing build. Installing build..."; \
- $(PYTHON) -m pip install "build>=0.8.0" >/dev/null; \
- $(PYTHON) -c "import build" >/dev/null 2>&1 || (echo "Failed to install build.";
exit 1); \
- )
check-bumpver:
desc: '[imported from Makefile] check-bumpver'
cmds:
- $(PYTHON) -c "import bumpver" >/dev/null 2>&1 || ( \
- echo "Missing bumpver. Installing bumpver..."; \
- $(PYTHON) -m pip install "bumpver>=2023.1129" >/dev/null; \
- $(PYTHON) -c "import bumpver" >/dev/null 2>&1 || ( \
- echo "bumpver still missing. Installing project dev dependencies..."; \
- $(PIP) install -e \".[dev]\"; \
- $(PYTHON) -c "import bumpver" >/dev/null 2>&1 || (echo "Failed to install bumpver.";
exit 1); \
- ); \
- )
examples:
desc: '[imported from Makefile] examples'
cmds:
- echo "$(BLUE)========================================$(NC)"
- echo "$(BLUE) preLLM Real-time Examples$(NC)"
- echo "$(BLUE)========================================$(NC)"
- echo ""
- echo "$(YELLOW)1. Quick Start Examples (async)$(NC)"
- echo "----------------------------------------"
- '$(PYTHON) examples/quick_start.py || echo "$(RED)Skipped: LLM providers not
configured$(NC)"'
- echo ""
- echo "$(YELLOW)2. Kubernetes Debugging Example$(NC)"
- echo "----------------------------------------"
- '$(PYTHON) examples/k8s_debug.py || echo "$(RED)Skipped: LLM providers not configured$(NC)"'
- echo ""
- echo "$(YELLOW)3. Polish Finance Example$(NC)"
- echo "----------------------------------------"
- '$(PYTHON) examples/polish_leasing.py || echo "$(RED)Skipped: LLM providers
not configured$(NC)"'
- echo ""
- echo "$(YELLOW)4. Provider Configuration Example$(NC)"
- echo "----------------------------------------"
- '$(PYTHON) examples/providers.py || echo "$(RED)Skipped: LLM providers not configured$(NC)"'
- echo ""
- echo "$(YELLOW)5. Python SDK Examples$(NC)"
- echo "----------------------------------------"
- '$(PYTHON) examples/python_sdk.py || echo "$(RED)Skipped: LLM providers not
configured$(NC)"'
- echo ""
- echo "$(GREEN)Examples completed!$(NC)"
doctor:
desc: '[imported from Makefile] doctor'
cmds:
- $(RUN) prellm doctor
doctor-live:
desc: '[imported from Makefile] doctor-live'
cmds:
- $(RUN) prellm doctor --live
serve:
desc: '[imported from Makefile] serve'
cmds:
- $(RUN) prellm serve
query:
desc: '[imported from Makefile] query'
cmds:
- if [ -z "$(Q)" ]; then \
- $(RUN) prellm query "Hello world" --json; \
- else \
- $(RUN) prellm query "$(Q)" --json; \
- fi
config:
desc: '[imported from Makefile] config'
cmds:
- echo "$(BLUE)========================================$(NC)"
- echo "$(BLUE) preLLM Interactive Configuration$(NC)"
- echo "$(BLUE)========================================$(NC)"
- echo ""
- $(PYTHON) scripts/config_wizard.py
run:
desc: '[imported from Makefile] run'
cmds:
- $(RUN) prellm run "deploy to production" --dry-run
demo:
desc: '[imported from Makefile] demo'
cmds:
- echo "Generating demo config..."
- $(RUN) prellm init --devops
- echo ""
- echo "Running demo analysis..."
- $(RUN) prellm analyze "zawsze restartuj serwer" --config rules.yaml
- echo ""
- echo "Running demo process chain..."
- $(RUN) prellm process configs/deploy.yaml --dry-run --guard-config rules.yaml
|| echo "Process chain config not found, skipping..."
init:
desc: '[imported from Makefile] init'
cmds:
- $(RUN) prellm init --devops
dev-setup:
desc: '[imported from Makefile] dev-setup'
cmds:
- echo "Setting up pre-commit hooks..."
- echo "#!/bin/bash" > .git/hooks/pre-commit
- echo "$(RUN) ruff check ." >> .git/hooks/pre-commit
- echo "$(RUN) python -m pytest tests/ -q" >> .git/hooks/pre-commit
- chmod +x .git/hooks/pre-commit
- echo "Pre-commit hooks installed!"
deps:
- install-dev
docs:
desc: '[imported from Makefile] docs'
cmds:
- echo "Generating documentation..."
- echo "# Prellm Documentation" > DOCS.md
- echo "" >> DOCS.md
- echo "## Installation" >> DOCS.md
- echo '```bash' >> DOCS.md
- echo "pip install prellm" >> DOCS.md
- echo '```' >> DOCS.md
- echo "" >> DOCS.md
- echo "## Quick Start" >> DOCS.md
- echo '```bash' >> DOCS.md
- echo "prellm init --devops" >> DOCS.md
- echo "prellm run \"deploy to production\" --dry-run" >> DOCS.md
- echo '```' >> DOCS.md
- echo "Documentation generated in DOCS.md"
version-patch:
desc: '[imported from Makefile] version-patch'
cmds:
- poetry version patch
- echo "Version bumped to patch level"
version-minor:
desc: '[imported from Makefile] version-minor'
cmds:
- poetry version minor
- echo "Version bumped to minor level"
version-major:
desc: '[imported from Makefile] version-major'
cmds:
- poetry version major
- echo "Version bumped to major level"
docker-run:
desc: '[imported from Makefile] docker-run'
cmds:
- docker run --rm -it prellm:latest
ci-test:
desc: '[imported from Makefile] ci-test'
cmds:
- ifeq ($(POETRY),)
- $(PIP) install -e .
- else
- poetry install --only main
- endif
- $(RUN) python -m pytest tests/ -v
- $(RUN) ruff check .
ci-build:
desc: '[imported from Makefile] ci-build'
cmds:
- $(PYTHON) -m build
- echo "Build completed successfully"
release:
desc: '[imported from Makefile] release'
cmds:
- echo "Ready for release! Run 'make publish' to upload to PyPI"
deps:
- clean
- test
- lint
- build
dev:
desc: '[imported from Makefile] dev'
cmds:
- echo "Development environment ready!"
deps:
- install-dev
- test
- lint
bump-minor:
desc: '[imported from Makefile] bump-minor'
cmds:
- $(PYTHON) -m bumpver update --minor
bump-major:
desc: '[imported from Makefile] bump-major'
cmds:
- $(PYTHON) -m bumpver update --major
set-version:
desc: '[imported from Makefile] set-version'
cmds:
- 'if [ -z "$(VERSION)" ]; then echo "Usage: make set-version VERSION=1.2.3";
exit 1; fi'
- $(PYTHON) -m bumpver update --set-version $(VERSION)
- echo "Version set to $(VERSION)"
health:
desc: '[from doql] workflow: health'
cmds:
- docker compose ps
- docker compose exec app echo "Health check passed"
import-makefile-hint:
desc: '[from doql] workflow: import-makefile-hint'
cmds:
- 'echo ''Run: taskfile import Makefile to import existing targets.'''
all:
desc: Run install, lint, test
cmds:
- taskfile run install
- taskfile run lint
- taskfile run test