# Detector Worker Makefile # Provides convenient commands for development, testing, and deployment .PHONY: help install install-dev test test-unit test-integration test-performance test-all test-fast test-coverage lint format clean run docker-build docker-run # Default target help: @echo "Detector Worker - Available Commands:" @echo "" @echo "Development Setup:" @echo " make install Install production dependencies" @echo " make install-dev Install development dependencies" @echo "" @echo "Testing:" @echo " make test Run all tests" @echo " make test-unit Run unit tests only" @echo " make test-integration Run integration tests" @echo " make test-performance Run performance benchmarks" @echo " make test-fast Run fast tests only" @echo " make test-coverage Generate coverage report" @echo "" @echo "Code Quality:" @echo " make lint Run code linting" @echo " make format Format code with black and isort" @echo " make quality Run all quality checks" @echo "" @echo "Development:" @echo " make run Run the detector worker" @echo " make clean Clean build artifacts" @echo "" @echo "Docker:" @echo " make docker-build Build Docker image" @echo " make docker-run Run Docker container" # Installation targets install: pip install -r requirements.txt install-dev: install pip install -r requirements-dev.txt # Testing targets test: python scripts/run_tests.py --all test-unit: python scripts/run_tests.py --unit --verbose test-integration: python scripts/run_tests.py --integration --verbose test-performance: python scripts/run_tests.py --performance --verbose test-fast: python scripts/run_tests.py --fast --verbose test-coverage: python scripts/run_tests.py --coverage --open-browser test-failed: python scripts/run_tests.py --failed --verbose # Code quality targets lint: @echo "Running flake8..." -flake8 detector_worker --max-line-length=120 --extend-ignore=E203,W503 @echo "Running mypy..." -mypy detector_worker --ignore-missing-imports --no-strict-optional format: @echo "Formatting with black..." black detector_worker tests scripts @echo "Sorting imports with isort..." isort detector_worker tests scripts quality: lint python scripts/run_tests.py --quality # Development targets run: python app.py run-debug: python app.py --debug clean: @echo "Cleaning build artifacts..." rm -rf build/ rm -rf dist/ rm -rf *.egg-info/ rm -rf htmlcov/ rm -rf .coverage rm -rf coverage.xml rm -rf test-results.xml rm -rf .pytest_cache/ find . -type d -name __pycache__ -delete find . -type f -name "*.pyc" -delete find . -type f -name "*.pyo" -delete # Docker targets docker-build: docker build -t detector-worker . docker-run: docker run -p 8000:8000 detector-worker docker-dev: docker run -it -v $(PWD):/app -p 8000:8000 detector-worker bash # CI/CD targets ci-test: python scripts/run_tests.py --all --skip-slow ci-quality: python scripts/run_tests.py --quality # Documentation targets docs: @echo "Documentation generation not yet implemented" # Development utilities check-deps: pip check update-deps: pip list --outdated freeze: pip freeze > requirements-frozen.txt # Performance profiling profile: python -m cProfile -o profile_output.prof app.py @echo "Profile saved to profile_output.prof" @echo "View with: python -m pstats profile_output.prof" # Database utilities (if needed) db-migrate: @echo "Database migration not yet implemented" db-reset: @echo "Database reset not yet implemented" # Monitor and debug monitor: @echo "Starting system monitor..." python -c "import psutil; import time; [print(f'CPU: {psutil.cpu_percent()}%, Memory: {psutil.virtual_memory().percent}%') or time.sleep(1) for _ in range(60)]" # Utility targets version: python -c "import detector_worker; print(f'Detector Worker Version: {getattr(detector_worker, \"__version__\", \"unknown\")}')" env-info: @echo "Environment Information:" @echo "Python: $(shell python --version)" @echo "Pip: $(shell pip --version)" @echo "Working Directory: $(PWD)" @echo "Git Branch: $(shell git branch --show-current 2>/dev/null || echo 'Not a git repository')" @echo "Git Commit: $(shell git rev-parse --short HEAD 2>/dev/null || echo 'Not a git repository')"