File size: 2,791 Bytes
fd357f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# DTO Framework Makefile
# Common tasks and utilities

.PHONY: help install test lint format docker clean

# Default target
help:
	@echo "DTO Framework Build System"
	@echo ""
	@echo "Usage:"
	@echo "  make [target]"
	@echo ""
	@echo "Targets:"
	@echo "  install     Install dependencies"
	@echo "  test        Run tests"
	@echo "  lint        Run linting and code checks"
	@echo "  format      Format code"
	@echo "  docker      Build Docker image"
	@echo "  clean       Clean build artifacts"
	@echo "  validate    Validate DTO manifest"
	@echo "  generate    Generate configuration"
	@echo "  docs        Build documentation"

# Install dependencies
install:
	pip install -r requirements.txt
	pip install -r requirements-dev.txt

# Run tests
test:
	python -m pytest tests/ -v --cov=.

# Linting and code quality
lint:
	@echo "Running linting..."
	flake8 . --max-line-length=88 --extend-ignore=E203
	mypy . --ignore-missing-imports
	bandit -r . -x tests

# Code formatting
format:
	black .
	isort .

# Build Docker image
docker:
	@echo "Building DTO Docker image..."
	docker build -t adaptai/dto-framework:latest .

# Clean build artifacts
clean:
	@echo "Cleaning build artifacts..."
	rm -rf __pycache__ */__pycache__ *.pyc
	rm -rf .pytest_cache .coverage htmlcov
	rm -rf build/ dist/ *.egg-info

# Validate DTO manifest
validate:
	python validate-ci.py

# Generate configuration
generate:
	python generate.py

# Build documentation
docs:
	@echo "Building documentation..."
	mkdocs build

# Development server
dev:
	@echo "Starting development server..."
	python -m http.server 8000

# Production run
run:
	@echo "Starting DTO framework..."
	python services/dto_service_manager.py

# Security scan
security:
	@echo "Running security scan..."
	bandit -r .
	safety check

# Dependency update
update:
	@echo "Updating dependencies..."
	pip install --upgrade -r requirements.txt

# Containerized development
dev-container:
	@echo "Starting development container..."
	docker compose -f docker-compose.dev.yml up --build

# Database migration
migrate:
	@echo "Running database migrations..."
	python database/migrate.py

# Backup configuration
backup:
	@echo "Creating backup..."
	tar czf dto-backup-$(date +%Y%m%d-%H%M%S).tar.gz . --exclude=".git" --exclude="__pycache__"

# Performance test
perf-test:
	@echo "Running performance tests..."
	python tests/performance_test.py

# Release preparation
release:
	@echo "Preparing release..."
	make test
	make lint
	make security
	make docs
	@echo "Release preparation complete!"

# Quick validation
quick-check:
	@echo "Running quick validation..."
	python validate-ci.py --quick
	@echo "Quick check passed!"

# Environment setup
setup:
	@echo "Setting up development environment..."
	make install
	make generate
	@echo "Environment setup complete!"