-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (86 loc) · 3.2 KB
/
Makefile
File metadata and controls
103 lines (86 loc) · 3.2 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
.PHONY: help bootstrap dev run release test clean docker-build docker-run docker-push install uninstall
# Default target
help:
@echo "Understand-First - Available targets:"
@echo " dev - Set up local development environment"
@echo " run - Run the application locally"
@echo " release - Build and publish artifacts (dry-run supported)"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " install - Install the package locally"
@echo " uninstall - Uninstall the package"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
@echo " docker-push - Push Docker image to registry"
# Development setup (prefer uv + uv.lock; fallback: pip extras)
bootstrap: dev
dev:
@echo "Setting up local development environment..."
python3 -m pip install --upgrade pip
@command -v uv >/dev/null 2>&1 && uv sync --all-extras || pip install -e ".[dev,examples]"
@echo "Development environment ready!"
@echo "Run 'make run' to start the application"
# Run the application
run:
@echo "Starting Understand-First..."
@echo "Starting HTTP server on port 8000..."
uvicorn examples.servers.http_server:app --host 127.0.0.1 --port 8000 &
@echo "Starting gRPC server on port 50051..."
python examples/servers/grpc_server.py &
@echo "Servers started!"
@echo "HTTP API: http://localhost:8000"
@echo "gRPC: localhost:50051"
@echo "Run 'u demo' to see a complete example"
# Build and publish (dry-run supported)
release:
@echo "Building package..."
python -m build
@echo "Package built successfully!"
@echo "To publish to PyPI:"
@echo " twine upload dist/*"
@echo "To publish to GitHub Container Registry:"
@echo " docker build -t ghcr.io/sentinelops-ci/understand-first:latest ."
@echo " docker push ghcr.io/sentinelops-ci/understand-first:latest"
# Testing
test: ci-local
ci-local:
@command -v uv >/dev/null 2>&1 && uv run pytest -q || pytest -q
# Clean build artifacts
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf cli/*.egg-info/
rm -rf __pycache__/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
# Package management
install:
pip install -e ".[dev,examples]"
uninstall:
pip uninstall understand-first -y
# Docker targets
docker-build:
@echo "Building Docker image..."
docker build -t understand-first:latest .
@echo "Docker image built successfully!"
docker-run:
@echo "Running Docker container..."
docker run --rm -p 8000:8000 -p 50051:50051 understand-first:latest
docker-push:
@echo "Pushing Docker image to registry..."
docker tag understand-first:latest ghcr.io/sentinelops-ci/understand-first:latest
docker push ghcr.io/sentinelops-ci/understand-first:latest
# Legacy targets for compatibility
tour:
u scan . -o maps/repo.json || true
u lens from-seeds --map maps/repo.json -o maps/lens.json || true
u trace module examples/app/hot_path.py run_hot_path -o traces/tour.json
u lens merge-trace maps/lens.json traces/tour.json -o maps/lens_merged.json
u tour maps/lens_merged.json -o tours/local.md
vsix:
cd ide/vscode/understand-first && npx --yes @vscode/vsce package --no-yarn
wheel:
python -m build
smoke:
@command -v uv >/dev/null 2>&1 && uv run pytest -q || pytest -q