-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (145 loc) · 5.32 KB
/
Makefile
File metadata and controls
176 lines (145 loc) · 5.32 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
# Makefile for Prompt Evaluator - Simplified Core Testing
.PHONY: help install install-test test test-core test-simple test-converter test-reader test-integration lint format type-check security clean setup-dev run-concurrent test-concurrent
# Default target
help:
@echo "Prompt Evaluator - Core Functionality Testing"
@echo ""
@echo "Setup:"
@echo " install Install production dependencies"
@echo " install-test Install testing dependencies"
@echo " setup-dev Setup development environment"
@echo ""
@echo "Core Testing:"
@echo " test Run all tests (legacy)"
@echo " test-core Run all core functionality tests"
@echo " test-simple Run core functionality tests only"
@echo " test-converter Run dataset converter tests only"
@echo " test-reader Run enhanced reader tests only"
@echo " test-integration Run integration tests only"
@echo " test-concurrent Test concurrent evaluator with small dataset"
@echo ""
@echo "Concurrent Evaluation:"
@echo " run-concurrent Run concurrent evaluation (requires dataset path)"
@echo ""
@echo "Code Quality:"
@echo " lint Run linting checks"
@echo " format Format code with black"
@echo " type-check Run type checking with mypy"
@echo " security Run security scans"
@echo ""
@echo "Utilities:"
@echo " clean Clean up generated files"
@echo " validate Validate setup and dependencies"
# Installation
install:
pip install -r requirements.txt
install-test:
pip install -r requirements.txt
pip install -r requirements-test.txt
setup-dev: install-test
@echo "Setting up development environment..."
@echo "Creating .env file if it doesn't exist..."
@if [ ! -f .env ]; then \
echo "CALYPSOAI_URL=https://calypsoai.app" > .env; \
echo "CALYPSOAI_TOKEN=your_api_token_here" >> .env; \
echo "Created .env file with template values"; \
fi
@echo "Development environment ready!"
# Testing
test:
python -m pytest tests/ -v
test-core:
python tests/test_runner_simple.py --all
test-simple:
python tests/test_runner_simple.py --core
test-converter:
python tests/test_runner_simple.py --converter
test-reader:
python tests/test_runner_simple.py --reader
test-integration:
python tests/test_runner_simple.py --integration
# Legacy test commands (kept for compatibility)
test-unit:
python -m pytest tests/test_dataset_converter.py tests/test_enhanced_reader.py -v
test-format:
python -m pytest tests/test_core_functionality.py -v
test-migration:
@echo "Migration tests removed - use test-core instead"
test-performance:
python -m pytest tests/test_core_functionality.py::TestCoreIntegration::test_performance_with_large_dataset -v
test-coverage:
python -m pytest tests/test_core_functionality.py tests/test_dataset_converter.py tests/test_enhanced_reader.py tests/test_integration.py --cov=. --cov-report=html --cov-report=term-missing
# Code Quality
lint:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
format:
black . --check --diff
format-fix:
black .
type-check:
mypy . --ignore-missing-imports --no-error-summary
security:
bandit -r . -f json -o bandit-report.json
safety check --json --output safety-report.json
# Utilities
clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf build/
rm -rf dist/
rm -rf htmlcov/
rm -rf .coverage
rm -rf coverage.xml
rm -rf bandit-report.json
rm -rf safety-report.json
rm -rf .pytest_cache/
validate:
python validate_setup.py
# Pre-commit checks
pre-commit: lint format type-check test-core
@echo "Pre-commit checks completed!"
# GitLab CI/CD simulation
ci-test: install-test lint format type-check test-core security
@echo "GitLab CI/CD simulation completed!"
# Development workflow
dev-test: test-simple test-converter
@echo "Development tests completed!"
# Release preparation
release-check: clean install-test lint format type-check test-core security
@echo "Release checks completed!"
@echo "Ready for release!"
# Quick test for development
quick-test:
python tests/test_runner_simple.py --core
# Concurrent Evaluation
run-concurrent:
@echo "Running concurrent evaluator..."
@if [ -z "$(DATASET)" ]; then \
echo "Usage: make run-concurrent DATASET=datasets/your_dataset.csv [CONCURRENCY=10] [LINES=50]"; \
exit 1; \
fi
@CONCURRENCY=$${CONCURRENCY:-10}; \
LINES=$${LINES:-}; \
if [ -n "$$LINES" ]; then \
python prompt_evaluator_concurrent.py -i "$(DATASET)" -c $$CONCURRENCY -l $$LINES; \
else \
python prompt_evaluator_concurrent.py -i "$(DATASET)" -c $$CONCURRENCY; \
fi
test-concurrent:
@echo "Testing concurrent evaluator with small dataset..."
@if [ -f datasets/prompt_inject_dataset.csv ]; then \
python prompt_evaluator_concurrent.py -i datasets/prompt_inject_dataset.csv -l 20 -c 5; \
elif [ -f datasets/pii_dataset.csv ]; then \
python prompt_evaluator_concurrent.py -i datasets/pii_dataset.csv -l 20 -c 5; \
else \
echo "No test dataset found. Please provide a dataset in the datasets/ directory."; \
exit 1; \
fi
# Documentation testing
test-docs:
@echo "Testing documentation examples..."
python tools/demo_improved_formats.py
python tools/example_improved_formats.py
@echo "Documentation tests completed!"