-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
308 lines (260 loc) · 9.89 KB
/
Copy pathjustfile
File metadata and controls
308 lines (260 loc) · 9.89 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
# ax_utils development tasks (uv-native)
# Requires: just (https://github.com/casey/just) and uv
# Install: brew install just
# Default recipe - show help
default:
@just --list
# 🔧 Check CI environment compatibility
check-ci:
@echo "🔍 Checking CI environment compatibility..."
uv run python scripts/check_ci_env.py
# 🧹 Clean all build artifacts and caches
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf .uv-cache/
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type f -name "*.pyo" -delete 2>/dev/null || true
find . -type f -name "*.so" -delete 2>/dev/null || true
@echo "✅ Clean complete"
# 🔧 Sync development dependencies (uv native)
sync:
@echo "🔧 Syncing dependencies..."
uv sync --group dev
@echo "✅ Dependencies synced"
# 🔧 Install development dependencies (legacy compatibility)
install-dev: sync
# 🏗️ Build C/C++ extensions in-place for development
build:
@echo "🏗️ Building C/C++ extensions..."
uv run python setup.py build_ext --inplace
@echo "✅ Extensions built successfully"
# 📦 Build distribution packages (source + wheel) - uv native
dist: clean
@echo "📦 Building distribution packages with uv..."
uv build
@echo "✅ Distribution packages built:"
@ls -la dist/
# 📦 Build multi-platform wheels using cibuildwheel (like CI does)
dist-wheels: clean
@echo "📦 Building multi-platform wheels with cibuildwheel..."
@echo "⚠️ This will build wheels for current platform only (use CI for all platforms)"
uv run --group dev cibuildwheel --output-dir wheelhouse
@echo "✅ Wheels built:"
@ls -lh wheelhouse/
# 🧪 Run all tests
test: build
@echo "🧪 Running test suite..."
uv run --group test pytest tests/ -v --tb=short
# 🧪 Run specific test file
test-file FILE: build
@echo "🧪 Running tests in {{FILE}}..."
uv run --group test pytest {{FILE}} -v
# 🧪 Run tests with coverage
test-cov: build
@echo "🧪 Running tests with coverage..."
uv run --group test pytest tests/ --cov=ax_utils --cov-report=html --cov-report=term
# 🏃 Run quick functionality tests
test-quick: build
@echo "🏃 Running quick functionality tests..."
uv run python scripts/quick_test.py
# 🚀 Run performance benchmarks
benchmark: build
@echo "🚀 Running performance benchmarks..."
uv run --group dev pytest tests/test_benchmarks.py -v --benchmark-only
# 🧪 Run integration tests
test-integration: build
@echo "🧪 Running integration tests..."
uv run --group test pytest tests/test_integration.py
# 🧪 Run all original module tests (from ax_utils subdirectories)
test-original: build
@echo "🧪 Running original module test suites..."
uv run --group test pytest ax_utils/*/tests/ -v
# 🔍 Run linting and code quality checks
lint:
@echo "🔍 Running linting checks..."
uv run --group dev ruff check ax_utils/ tests/
uv run --group dev ruff format --check ax_utils/ tests/
# 🔧 Auto-fix code formatting
format:
@echo "🔧 Formatting code..."
uv run --group dev ruff check --fix ax_utils/ tests/
uv run --group dev ruff format ax_utils/ tests/
@echo "✅ Code formatted"
# 🔬 Run type checking
typecheck:
@echo "🔬 Running type checks..."
uv run --group dev mypy ax_utils/ --ignore-missing-imports
# ✅ Run complete quality checks (lint + typecheck + test)
check: lint typecheck test
@echo "✅ All quality checks passed!"
# 🚀 Install package in development mode (uv native)
install-editable:
@echo "🚀 Installing package in editable mode..."
uv pip install -e .
@echo "✅ Package installed in editable mode"
# 🚀 Install package in development mode (legacy alias)
install-dev-package: install-editable
# 📊 Show package info
info:
@echo "📊 Package Information:"
@echo "Name: ax_utils"
@echo "Version: 3.0.2"
@uv run python -c "import ax_utils; print(f'Location: {ax_utils.__file__}')" 2>/dev/null || echo "Package not installed"
@echo ""
@echo "📁 Directory structure:"
@find ax_utils -name "*.py" -o -name "*.c" -o -name "*.cpp" | head -10
@echo ""
@echo "🔧 Build artifacts:"
@find ax_utils -name "*.so" 2>/dev/null | wc -l | xargs echo "Compiled extensions:"
@echo ""
@echo "📦 uv project info:"
@uv tree --group dev | head -20
# 🧪 Test import and basic functionality (alias for test-quick)
test-import: test-quick
# 📋 Validate package for PyPI publishing
validate: clean dist
@echo "📋 Validating package for PyPI..."
uv run --group dev twine check dist/*
@echo "✅ Package validation complete"
# 🚀 Publish to PyPI (requires authentication) - uv native
publish: dist
@echo "🚀 Publishing to PyPI with uv..."
@echo "⚠️ This will upload to PyPI. Make sure you're ready!"
@read -p "Continue? (y/N): " confirm && [ "$$confirm" = "y" ] || exit 1
uv publish --token "$(pass pypitoken)" dist/*
@echo "✅ Package published to PyPI!"
# 🚀 Publish to Test PyPI (for testing) - uv native
publish-test: dist
@echo "🚀 Publishing to Test PyPI with uv..."
uv publish --repository testpypi dist/*
@echo "✅ Package published to Test PyPI!"
# 🔄 Full development cycle (clean, build, test, lint)
dev: clean sync build test-quick lint
@echo "🔄 Development cycle complete!"
# 🚀 Full release cycle (clean, build, test, lint, dist) - bypasses validation due to nh3 issue
release: clean sync build test lint dist
@echo "🚀 Release preparation complete!"
@echo "📦 Files ready for release:"
@ls -la dist/
@echo ""
@echo "Next steps:"
@echo " just publish-test # Test on Test PyPI first"
@echo " just publish # Publish to real PyPI"
@echo " just validate # Optional validation (has known nh3 issue)"
# 🚀 Release new version with multi-platform wheels via GitHub Actions
release-wheels VERSION:
#!/usr/bin/env bash
set -euo pipefail
# Extract version from pyproject.toml
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "🔍 Current version: $CURRENT_VERSION"
echo "🎯 New version: {{VERSION}}"
echo ""
# Confirm with user
read -p "Update version from $CURRENT_VERSION to {{VERSION}} and create release? (y/N): " confirm
if [ "$confirm" != "y" ]; then
echo "❌ Release cancelled"
exit 1
fi
echo "📝 Updating version in pyproject.toml and setup.py..."
sed -i.bak 's/^version = ".*"/version = "{{VERSION}}"/' pyproject.toml
sed -i.bak 's/return ".*"/return "{{VERSION}}"/' setup.py
rm -f pyproject.toml.bak setup.py.bak
echo "✅ Version updated to {{VERSION}}"
echo ""
echo "📦 Committing version bump..."
git add pyproject.toml setup.py
git commit -m "Bump version to {{VERSION}}"
echo "🏷️ Creating git tag v{{VERSION}}..."
git tag v{{VERSION}}
echo "🚀 Pushing to GitHub..."
git push origin main
git push origin v{{VERSION}}
echo ""
echo "✅ Release initiated!"
echo "📊 GitHub Actions will now:"
echo " 1. Build wheels for Linux x86_64 and ARM64"
echo " 2. Build source distribution"
echo " 3. Publish to PyPI"
echo ""
echo "🔗 View progress: https://github.com/axgkl/ax_utils/actions"
# 🐛 Debug build issues
debug-build:
@echo "🐛 Debug build information..."
@echo "Python version:"
@uv run python --version
@echo ""
@echo "uv version:"
@uv --version
@echo ""
@echo "Compiler information:"
@which gcc || echo "gcc not found"
@which clang || echo "clang not found"
@echo ""
@echo "Extension files:"
@find ax_utils -name "*.c" -o -name "*.cpp"
@echo ""
@echo "Compiled extensions:"
@find ax_utils -name "*.so" || echo "No compiled extensions found"
@echo ""
@echo "uv environment info:"
@uv python list
@echo ""
@echo "Build with verbose output:"
uv run python setup.py build_ext --inplace --verbose
# 🧹 Deep clean (including uv cache)
clean-all: clean
@echo "🧹 Deep cleaning (including uv cache)..."
uv cache clean
rm -rf .uv-cache/
@echo "✅ Deep clean complete"
# 📊 Run complete test suite with reports
test-all: build
@echo "📊 Running complete test suite..."
uv run --group dev pytest tests/ -v --tb=short --cov=ax_utils --cov-report=html --cov-report=term --cov-report=xml
@echo "📊 Test reports generated:"
@echo " - HTML coverage: htmlcov/index.html"
@echo " - XML coverage: coverage.xml"
# 🏃 Quick development check (fast version of dev cycle)
quick: build test-quick
@echo "🏃 Quick check complete!"
# 🔧 Setup development environment from scratch (uv native)
setup:
@echo "🔧 Setting up development environment with uv..."
uv sync --group dev
uv pip install -e .
@echo "🔧 Development environment setup complete!"
@echo ""
@echo "🎯 Available commands:"
@just --list
# 🔍 Show dependency tree
deps:
@echo "🔍 Dependency tree:"
uv tree --group dev
# 🔄 Update dependencies to latest compatible versions
update:
@echo "🔄 Updating dependencies..."
uv lock --upgrade
uv sync --group dev
@echo "✅ Dependencies updated"
# 🚀 Run in production mode (no dev dependencies)
run-prod:
@echo "🚀 Running with production dependencies only..."
uv run --no-group python -c "import ax_utils; print('ax_utils loaded successfully')"
# 🔧 Add new dependency
add DEP:
@echo "🔧 Adding dependency: {{DEP}}"
uv add {{DEP}}
# 🔧 Add new dev dependency
add-dev DEP:
@echo "🔧 Adding dev dependency: {{DEP}}"
uv add --group dev {{DEP}}
# 🗑️ Remove dependency
remove DEP:
@echo "🗑️ Removing dependency: {{DEP}}"
uv remove {{DEP}}