-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
190 lines (168 loc) · 7.87 KB
/
Makefile
File metadata and controls
190 lines (168 loc) · 7.87 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
PYTHON_DIRS = tests examples scripts eval_protocol
.PHONY: clean build dist upload test lint typecheck format release sync-docs version tag-version show-version bump-major bump-minor bump-patch full-release quick-release
clean:
rm -rf build/ dist/ *.egg-info/
pre-commit:
pre-commit run --all-files
build: clean
python -m build
dist: build
upload:
twine upload dist/*
test:
pytest
lint:
flake8 $(PYTHON_DIRS)
typecheck:
mypy $(PYTHON_DIRS)
format:
black $(PYTHON_DIRS)
validate-docs:
@echo "Validating documentation links..."
@if [ -f ~/home/docs/scripts/validate_links.py ]; then \
cd ~/home/docs && python scripts/validate_links.py; \
else \
echo "❌ Error: Link validation script not found at ~/home/docs/scripts/validate_links.py"; \
echo "Please ensure the validation script exists."; \
exit 1; \
fi
# Version management commands using versioneer
version:
@echo "Current version information:"
@python -c "import versioneer; print('Version:', versioneer.get_version())"
@python -c "import versioneer; v = versioneer.get_versions(); print('Full info:', v)"
show-version:
@python -c "import versioneer; print(versioneer.get_version())"
# Tag the current commit for release (creates git tag)
tag-version:
@echo "Current version: $$(python -c 'import versioneer; print(versioneer.get_version())')"
@read -p "Enter version to tag (e.g., 1.2.3): " version && \
git tag -a "v$$version" -m "Release version $$version" && \
echo "Tagged version v$$version"
# Helper commands for semantic versioning bumps
bump-patch:
@current=$$(python -c "import versioneer; v=versioneer.get_version(); print(v.split('+')[0] if '+' in v else v)"); \
if echo "$$current" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$' > /dev/null; then \
major=$$(echo $$current | cut -d. -f1); \
minor=$$(echo $$current | cut -d. -f2); \
patch=$$(echo $$current | cut -d. -f3); \
next_patch=$$(( $$patch + 1 )); \
next_version="$$major.$$minor.$$next_patch"; \
echo "Current version: $$current"; \
echo "Next patch version: $$next_version"; \
read -p "Create tag v$$next_version? [y/N]: " confirm; \
if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
git tag -a "v$$next_version" -m "Release version $$next_version" && \
echo "Tagged version v$$next_version"; \
fi; \
else \
echo "Current version ($$current) is not in semantic version format. Use 'make tag-version' instead."; \
fi
bump-minor:
@current=$$(python -c "import versioneer; v=versioneer.get_version(); print(v.split('+')[0] if '+' in v else v)"); \
if echo "$$current" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$' > /dev/null; then \
major=$$(echo $$current | cut -d. -f1); \
minor=$$(echo $$current | cut -d. -f2); \
next_minor=$$(( $$minor + 1 )); \
next_version="$$major.$$next_minor.0"; \
echo "Current version: $$current"; \
echo "Next minor version: $$next_version"; \
read -p "Create tag v$$next_version? [y/N]: " confirm; \
if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
git tag -a "v$$next_version" -m "Release version $$next_version" && \
echo "Tagged version v$$next_version"; \
fi; \
else \
echo "Current version ($$current) is not in semantic version format. Use 'make tag-version' instead."; \
fi
bump-major:
@current=$$(python -c "import versioneer; v=versioneer.get_version(); print(v.split('+')[0] if '+' in v else v)"); \
if echo "$$current" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$' > /dev/null; then \
major=$$(echo $$current | cut -d. -f1); \
next_major=$$(( $$major + 1 )); \
next_version="$$next_major.0.0"; \
echo "Current version: $$current"; \
echo "Next major version: $$next_version"; \
read -p "Create tag v$$next_version? [y/N]: " confirm; \
if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
git tag -a "v$$next_version" -m "Release version $$next_version" && \
echo "Tagged version v$$next_version"; \
fi; \
else \
echo "Current version ($$current) is not in semantic version format. Use 'make tag-version' instead."; \
fi
# Full release workflow with version tagging
full-release: lint typecheck test
@echo "Current version: $$(python -c 'import versioneer; print(versioneer.get_version())')"
@read -p "Enter new version to release (e.g., 1.2.3): " version && \
git tag -a "v$$version" -m "Release version $$version" && \
echo "Tagged version v$$version" && \
$(MAKE) build && \
$(MAKE) upload && \
echo "Released version $$version to PyPI" && \
echo "Don't forget to push the tag: git push origin v$$version"
# Quick release workflow (skips lint and typecheck)
quick-release: test
@echo "⚠️ WARNING: Skipping lint and typecheck for quick release"
@echo "Current version: $$(python -c 'import versioneer; print(versioneer.get_version())')"
@read -p "Enter new version to release (e.g., 1.2.3): " version && \
git tag -a "v$$version" -m "Release version $$version" && \
echo "Tagged version v$$version" && \
$(MAKE) build && \
$(MAKE) upload && \
echo "Released version $$version to PyPI" && \
echo "Don't forget to push the tag: git push origin v$$version"
# This help target prints all available targets
help:
@echo "Available targets:"
@echo " clean - Remove build artifacts"
@echo " build - Build source and wheel distributions"
@echo " dist - Alias for build"
@echo " upload - Upload to PyPI (make sure to bump version first)"
@echo " test - Run tests"
@echo " lint - Run flake8 linter"
@echo " typecheck - Run mypy type checker"
@echo " format - Run black code formatter"
@echo " validate-docs - Validate all documentation links in docs.json"
@echo " sync-docs - Sync docs to ~/home/docs with links under 'evaluators'"
@echo " release - Run lint, typecheck, test, build, then upload"
@echo ""
@echo "Version management (using versioneer):"
@echo " version - Show current version information"
@echo " show-version - Show current version string only"
@echo " tag-version - Interactively create a git tag for release"
@echo " bump-patch - Instructions for patch version bump"
@echo " bump-minor - Instructions for minor version bump"
@echo " bump-major - Instructions for major version bump"
@echo " full-release - Full release workflow: test, tag, build, upload"
@echo " quick-release - Quick release workflow: test, tag, build, upload (skips lint/typecheck)"
@echo ""
@echo "Usage examples:"
@echo " make version - Check current version"
@echo " make tag-version - Tag a new version"
@echo " make full-release - Complete release process"
@echo " make quick-release - Fast release (skips lint/typecheck)"
@echo " make release - Build and upload (assumes version already tagged)"
@echo " make lint - Only run linting"
@echo " make format - Format the code"
@echo " make sync-docs - Sync documentation with path adjustments"
release: lint typecheck test build upload
@echo "Published to PyPI"
# Demo for Remote Evaluation using Serveo.net
demo-remote-eval:
@echo "---------------------------------------------------------------------"
@echo "Running Remote Evaluation Demo with Serveo.net..."
@echo "This demo will:"
@echo "1. Generate a temporary API key."
@echo "2. Start a local mock API service."
@echo "3. Expose the mock API service to the internet using Serveo.net via SSH."
@echo " (Requires a working SSH client in your PATH)"
@echo "4. Run evaluation functions that call the tunneled mock API service."
@echo "5. Clean up all started processes on completion or interruption."
@echo "---------------------------------------------------------------------"
@echo "Log files for the demo will be created in ./logs/remote_eval_demo/"
@echo "Starting demo script..."
python examples/remote_eval_demo/run_demo.py
@echo "---------------------------------------------------------------------"
@echo "Remote Evaluation Demo finished."
@echo "---------------------------------------------------------------------"