-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
158 lines (118 loc) · 4.58 KB
/
Copy pathMakefile
File metadata and controls
158 lines (118 loc) · 4.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
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
# DevStream Development Makefile
# Quick commands for common development tasks
.PHONY: help install dev test lint format check setup clean docs
# Default target
help: ## Show this help message
@echo "DevStream Development Commands"
@echo "============================"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Installation and setup
install: ## Install dependencies with Poetry
poetry install --all-extras
dev: ## Install development dependencies
poetry install --all-extras --with dev,test,performance
poetry run pre-commit install
setup: ## Run development environment setup
poetry run python scripts/setup_dev.py setup
check-env: ## Check development environment
poetry run python scripts/setup_dev.py check
# Code quality
format: ## Format code with black and isort
poetry run black src tests scripts
poetry run isort src tests scripts
lint: ## Run all linters
poetry run ruff check src tests
poetry run mypy src
poetry run bandit -r src
check: format lint ## Format and lint code
# Testing
test: ## Run all tests
poetry run pytest
test-unit: ## Run unit tests only
poetry run pytest tests/unit -v
test-integration: ## Run integration tests
poetry run pytest tests/integration -v --requires-ollama
test-e2e: ## Run end-to-end tests
poetry run pytest tests/e2e -v --requires-ollama --requires-docker
test-coverage: ## Run tests with coverage report
poetry run pytest --cov=devstream --cov-report=html --cov-report=term
test-performance: ## Run performance benchmarks
poetry run pytest tests/unit -v --benchmark-only
# Development utilities
clean: ## Clean up temporary files
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -name "*.pyc" -delete
rm -rf build/ dist/ .coverage htmlcov/ .mypy_cache/ .ruff_cache/
docs: ## Generate documentation
poetry run mkdocs serve
docs-build: ## Build documentation
poetry run mkdocs build
# Database operations
db-init: ## Initialize database with schema (no data loss)
@if [ -f data/devstream.db ]; then \
printf "Database already exists at data/devstream.db\\n"; \
printf "Use make db-reset to recreate it from scratch.\\n"; \
else \
poetry run python scripts/setup-db.py --verbose; \
fi
db-migrate: ## Run database migrations
poetry run devstream-migrate
db-reset: ## Reset database (WARNING: destroys data)
rm -f data/*.db data/*.db-*
$(MAKE) db-init
# Ollama operations
ollama-models: ## Install recommended Ollama models
poetry run python scripts/setup_dev.py install-ollama-models
ollama-check: ## Check Ollama connectivity
curl -s http://localhost:11434/api/tags | python -m json.tool
# CI/CD
ci-install: ## Install for CI environment
poetry install --only=main,test
ci-test: ## Run CI test suite
poetry run pytest tests/ --tb=short --maxfail=5
ci-lint: ## Run CI linting
poetry run ruff check src tests --output-format=github
poetry run mypy src --no-error-summary
# Release
build: ## Build package
poetry build
version: ## Show current version
poetry version
version-patch: ## Bump patch version
poetry version patch
version-minor: ## Bump minor version
poetry version minor
# Docker development
docker-build: ## Build Docker development image
docker build -t devstream:dev .
docker-run: ## Run in Docker container
docker run -it --rm \
-v $(PWD):/workspace \
-p 8000:8000 \
devstream:dev
# Performance monitoring
profile: ## Run performance profiling
poetry run python -m cProfile -o profile.stats -m devstream.cli.main --help
poetry run python -c "import pstats; p = pstats.Stats('profile.stats'); p.sort_stats('cumulative').print_stats(20)"
memory-profile: ## Run memory profiling
poetry run mprof run python -m devstream.cli.main --help
poetry run mprof plot
# Development shortcuts
quick-test: ## Quick test run (unit only, no coverage)
poetry run pytest tests/unit -x -q
watch-tests: ## Watch files and run tests automatically
poetry run ptw --runner "pytest tests/unit -x -q"
dev-server: ## Start development server with hot reload
poetry run python -m devstream.cli.main serve --reload
# Debugging utilities
debug-config: ## Show current configuration
poetry run python -c "from devstream.core.config import DevStreamConfig; print(DevStreamConfig.from_env().json(indent=2))"
debug-deps: ## Check dependency tree
poetry show --tree
debug-env: ## Show environment information
@echo "Python: $(shell python --version)"
@echo "Poetry: $(shell poetry --version)"
@echo "Platform: $(shell uname -a)"
@echo "Working directory: $(PWD)"