-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (82 loc) · 4.47 KB
/
Makefile
File metadata and controls
105 lines (82 loc) · 4.47 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
.PHONY: help install install-dev install-whisperx test test-verbose test-integration test-coverage lint lint-fix format format-check type-check clean pre-commit pre-commit-install all-checks ci dev-setup stats
# Default target
.DEFAULT_GOAL := help
help: ## Show this help message
@echo "audio-refinery - GPU-accelerated audio processing pipeline"
@echo ""
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}'
install: ## Install production dependencies (excludes whisperx — see install-whisperx)
uv sync
install-dev: ## Install development dependencies (excludes whisperx — see install-whisperx)
uv sync --extra dev
install-whisperx: ## Install whisperx and its runtime deps separately (must run after install or install-dev)
uv pip install --no-deps "whisperx @ git+https://github.com/m-bain/whisperX.git@741ab9a2a8a1076c171e785363b23c55a91ceff1"
uv pip install "av==16.1.0" "ctranslate2==4.7.1" "faster-whisper==1.2.1" "flatbuffers==25.12.19" "nltk==3.9.2" "onnxruntime==1.24.1"
test: ## Run unit tests (no GPU required)
uv run python -m pytest tests/ -m "not integration"
test-verbose: ## Run unit tests with verbose output
uv run python -m pytest tests/ -m "not integration" -vv
test-integration: ## Run integration tests (requires GPU + models)
uv run python -m pytest tests/ -m "integration" -v
test-coverage: ## Run unit tests with coverage report (fails under 75%)
uv run python -m pytest tests/ -m "not integration" --cov=src --cov-report=term-missing --cov-report=html --cov-fail-under=75
@echo ""
@echo "Coverage report generated in htmlcov/index.html"
lint: ## Run linter (ruff)
uv run ruff check src/ tests/
lint-fix: ## Run linter and auto-fix issues
uv run ruff check --fix src/ tests/
format: ## Format code with ruff
uv run ruff format src/ tests/
format-check: ## Check code formatting without changing files
uv run ruff format --check src/ tests/
type-check: ## Run type checker (mypy)
uv run mypy src/ --ignore-missing-imports
pre-commit-install: ## Install pre-commit hooks
uv run pre-commit install
pre-commit: ## Run pre-commit hooks on all files
uv run pre-commit run --all-files
clean: ## Remove generated files and caches
rm -rf .pytest_cache .coverage htmlcov .mypy_cache .ruff_cache coverage.xml dist build *.egg-info
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name '*.pyc' -delete
all-checks: lint type-check test ## Run all checks (lint, type-check, test)
@echo ""
@echo "All checks passed!"
ci: install-dev all-checks ## Run CI pipeline (install deps + all checks)
@echo ""
@echo "CI pipeline completed successfully!"
install-torch-cuda: ## Reinstall PyTorch with CUDA 12.1 wheels (run after uv sync, which pulls CPU-only builds)
uv pip install torch==2.1.2+cu121 torchaudio==2.1.2+cu121 --extra-index-url https://download.pytorch.org/whl/cu121
dev-setup: install-dev install-whisperx install-torch-cuda pre-commit-install ## Complete development setup (installs all deps including whisperx + hooks)
@echo ""
@echo "Development environment setup complete!"
@echo ""
@echo "Next steps:"
@echo " 1. Copy .env.example to .env and add your HF_TOKEN"
@echo " 2. Run 'make test' to verify everything works"
@echo " 3. Run 'audio-refinery --help' to see available commands"
test-slack: ## Send a test Slack notification to verify SLACK_WEBHOOK_URL is configured
@uv run python -c "\
from dotenv import load_dotenv; \
load_dotenv(); \
import os, sys, json, urllib.request; \
url = os.getenv('SLACK_WEBHOOK_URL') or (print('SLACK_WEBHOOK_URL is not set — add it to .env or export it') or sys.exit(1)); \
data = json.dumps({'text': ':white_check_mark: *Test notification* from \`audio-refinery\` — Slack integration is working.'}).encode(); \
req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/json'}); \
urllib.request.urlopen(req, timeout=5); \
print('Test notification sent — check your Slack channel')"
stats: ## Show project statistics
@echo "Project Statistics:"
@echo "==================="
@printf "Lines of code (src/): "
@find src -name "*.py" -exec wc -l {} + | tail -1 | awk '{print $$1}'
@printf "Lines of tests: "
@find tests -name "*.py" -exec wc -l {} + | tail -1 | awk '{print $$1}'
@printf "Test files: "
@find tests -name "test_*.py" | wc -l | awk '{print $$1}'
@printf "Python modules: "
@find src -name "*.py" | wc -l | awk '{print $$1}'
@printf "Python version: "
@cat .python-version