Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (58 loc) · 2.58 KB
/
Copy pathMakefile
File metadata and controls
71 lines (58 loc) · 2.58 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
.PHONY: help check lint check-imports check-circular check-performance check-heavy test clean docs-prep docs-serve docs-build
PYTHON ?= python
APDEV ?= apdev
help:
@echo "Available commands:"
@echo " make check - Run lint, formatting checks, and tests"
@echo " make lint - Run Ruff and Black checks"
@echo " make check-imports - Run all import checks"
@echo " make check-circular - Detect circular imports"
@echo " make check-performance - Check import performance"
@echo " make check-heavy - Check for heavy module-level imports"
@echo " make test - Run tests"
@echo " make docs-prep - Generate docs/index.md from README.md (mirrors CI)"
@echo " make docs-serve - Prep + run mkdocs serve"
@echo " make docs-build - Prep + run mkdocs build"
@echo " make clean - Clean cache files"
# Run all import checks
check-imports: check-circular check-performance check-heavy
check: lint test
lint:
$(PYTHON) -m ruff check src/ tests/
$(PYTHON) -m black --check .
# Detect circular imports
check-circular:
@echo "Checking for circular imports..."
@$(APDEV) check-imports
# Check import performance
check-performance:
@echo "Checking import performance..."
@$(PYTHON) -m pytest tests/test_import_checks.py::test_cli_import_finishes_within_startup_budget -q
# Check for heavy imports at module level
check-heavy:
@echo "Checking for heavy module-level imports..."
@$(PYTHON) -m pytest tests/test_import_checks.py::test_cli_import_keeps_optional_frameworks_unloaded -q
# Run tests
test:
@$(PYTHON) -m pytest tests/ -v
# Clean cache files
clean:
@find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
@find . -type f -name "*.pyc" -delete
@find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@echo "Cache cleaned!"
# Generate docs/index.md from README.md and copy logo (mirrors .github/workflows/docs.yml)
docs-prep:
@cp README.md docs/index.md
@(printf '%s\n' '---' 'description: apflow documentation home for AI-perceivable distributed orchestration, quick start, architecture, and feature guides.' '---' ''; cat docs/index.md) > docs/index.md.tmp
@mv docs/index.md.tmp docs/index.md
@mkdir -p docs/assets
@cp apflow-logo.svg docs/assets/ 2>/dev/null || true
@sed -i.bak -e 's|\./docs/|./|g' -e 's|(docs/|(|g' -e 's|\./apflow-logo\.svg|./assets/apflow-logo.svg|g' docs/index.md && rm docs/index.md.bak
@echo "docs/index.md generated from README.md"
# Serve docs locally with mkdocs
docs-serve: docs-prep
@mkdocs serve
# Build docs locally
docs-build: docs-prep
@mkdocs build