- Renamed verify-setup to setup-verify for consistency with setup-* targets - Grouped all standards targets into dedicated section with standards- prefix - Renamed check-standards → standards-check, fix-standards → standards-fix, test-standards → standards-test - Updated help text with clear Standards Compliance section - Added visual section separators for better organization - Removed duplicate targets and cleaned up structure - Removed obsolete agent-repository-structure.md in favor of comprehensive agent-setupRepository.md 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
648 lines
26 KiB
Makefile
648 lines
26 KiB
Makefile
# Makefile for Kaizen Agentic development tasks
|
|
|
|
.PHONY: help setup-complete setup-structure setup-python setup-tools setup-docs setup-tests setup-verify ensure-project-structure install-dev standards-check standards-fix standards-test test test-all build clean lint format venv-status
|
|
|
|
# Variables
|
|
VENV = .venv
|
|
VENV_PYTHON = $(VENV)/bin/python
|
|
VENV_PIP = $(VENV)/bin/pip
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Kaizen Agentic Development Commands"
|
|
@echo "==================================="
|
|
@echo ""
|
|
@echo "Environment Status:"
|
|
@$(MAKE) --no-print-directory venv-status
|
|
@echo ""
|
|
@echo "Setup & Installation:"
|
|
@echo " setup-complete - Complete repository setup from stub (PythonVibes)"
|
|
@echo " setup-structure - Create directory structure and basic files"
|
|
@echo " setup-python - Configure Python package structure"
|
|
@echo " setup-tools - Install and configure development tools"
|
|
@echo " setup-docs - Generate documentation framework"
|
|
@echo " setup-tests - Create testing infrastructure"
|
|
@echo " setup-verify - Verify complete setup functionality"
|
|
@echo " install-dev - Install package in development mode"
|
|
@echo " venv-status - Check if venv is active"
|
|
@echo ""
|
|
@echo "Standards Compliance:"
|
|
@echo " standards-check - Check repository against PythonVibes standards"
|
|
@echo " standards-fix - Fix any standards violations found"
|
|
@echo " standards-test - Run repository standards compliance tests"
|
|
@echo ""
|
|
@echo "Development:"
|
|
@echo " test - Run unit tests only (fast)"
|
|
@echo " test-all - Run comprehensive test suite (tests + standards + quality)"
|
|
@echo " build - Build the package"
|
|
@echo " lint - Run code linting"
|
|
@echo " format - Format code with black"
|
|
@echo " clean - Clean build artifacts and cache"
|
|
@echo ""
|
|
@echo "Examples:"
|
|
@echo " make setup-complete # Set up new repository"
|
|
@echo " make test-all # Run full test suite"
|
|
@echo " make standards-check # Audit repository compliance"
|
|
|
|
# Virtual environment status check
|
|
venv-status:
|
|
@if [ -d "$(VENV)" ]; then \
|
|
echo "✅ Virtual environment: Active (.venv)"; \
|
|
echo " Python: $$($(VENV_PYTHON) --version 2>/dev/null || echo 'Not found')"; \
|
|
echo " Location: $$(pwd)/$(VENV)"; \
|
|
else \
|
|
echo "❌ Virtual environment: Not found"; \
|
|
echo " Run 'make setup-complete' to create it"; \
|
|
fi
|
|
|
|
# Create virtual environment
|
|
$(VENV)/bin/activate:
|
|
@echo "🔧 Creating virtual environment..."
|
|
python3 -m venv $(VENV)
|
|
@echo "✅ Virtual environment created at $(VENV)"
|
|
|
|
# Install package in development mode
|
|
install-dev: $(VENV)/bin/activate
|
|
@echo "📦 Installing package in development mode..."
|
|
@$(VENV_PIP) install --upgrade pip
|
|
@$(VENV_PIP) install -e .
|
|
@echo "✅ Package installed in development mode"
|
|
|
|
# Ensure proper Python project structure exists
|
|
ensure-project-structure:
|
|
@echo "🔍 Ensuring proper Python project structure..."
|
|
@if [ ! -f "pyproject.toml" ] && [ ! -f "setup.py" ]; then \
|
|
echo "❌ No pyproject.toml or setup.py found!"; \
|
|
echo " Creating minimal pyproject.toml..."; \
|
|
echo '[build-system]' > pyproject.toml; \
|
|
echo 'requires = ["setuptools>=64", "wheel"]' >> pyproject.toml; \
|
|
echo 'build-backend = "setuptools.build_meta"' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[project]' >> pyproject.toml; \
|
|
echo 'name = "kaizen-agentic"' >> pyproject.toml; \
|
|
echo 'version = "0.1.0"' >> pyproject.toml; \
|
|
echo 'description = "AI agent development framework"' >> pyproject.toml; \
|
|
echo 'requires-python = ">=3.8"' >> pyproject.toml; \
|
|
echo 'dependencies = []' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[tool.setuptools.packages.find]' >> pyproject.toml; \
|
|
echo 'where = ["src"]' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[tool.setuptools.package-dir]' >> pyproject.toml; \
|
|
echo '"" = "src"' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[tool.black]' >> pyproject.toml; \
|
|
echo 'line-length = 88' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[tool.flake8]' >> pyproject.toml; \
|
|
echo 'max-line-length = 100' >> pyproject.toml; \
|
|
echo '' >> pyproject.toml; \
|
|
echo '[tool.pytest.ini_options]' >> pyproject.toml; \
|
|
echo 'testpaths = ["tests"]' >> pyproject.toml; \
|
|
echo 'python_files = ["test_*.py"]' >> pyproject.toml; \
|
|
echo 'python_classes = ["Test*"]' >> pyproject.toml; \
|
|
echo 'python_functions = ["test_*"]' >> pyproject.toml; \
|
|
echo "✅ Created pyproject.toml with basic configuration"; \
|
|
else \
|
|
echo "✅ Project configuration file found"; \
|
|
fi
|
|
@if [ ! -d "src" ]; then \
|
|
echo " Creating src/ directory structure..."; \
|
|
mkdir -p src; \
|
|
echo "✅ Created src/ directory"; \
|
|
fi
|
|
|
|
# Complete setup with development dependencies
|
|
setup-complete: setup-structure setup-python setup-tools setup-docs setup-tests setup-verify
|
|
@echo "✅ Complete repository setup from stub finished!"
|
|
@echo ""
|
|
@echo "🎯 Repository now follows PythonVibes best practices:"
|
|
@echo " • Proper src/ layout with package structure"
|
|
@echo " • Development tools configured (black, flake8, mypy, pytest)"
|
|
@echo " • Essential documentation files created"
|
|
@echo " • Testing infrastructure established"
|
|
@echo " • Virtual environment and dependencies installed"
|
|
@echo ""
|
|
@echo "🚀 Next steps:"
|
|
@echo " 1. Activate virtual environment: source $(VENV)/bin/activate"
|
|
@echo " 2. Run tests: make test"
|
|
@echo " 3. Check code quality: make lint"
|
|
@echo " 4. Format code: make format"
|
|
|
|
# Create directory structure and basic files
|
|
setup-structure:
|
|
@echo "📁 Creating directory structure and basic files..."
|
|
@mkdir -p src docs tests .github/workflows
|
|
@if [ ! -f ".gitignore" ]; then \
|
|
echo "Creating .gitignore..."; \
|
|
echo "# Python" > .gitignore; \
|
|
echo "__pycache__/" >> .gitignore; \
|
|
echo "*.py[cod]" >> .gitignore; \
|
|
echo "*$$.py.class" >> .gitignore; \
|
|
echo "*.so" >> .gitignore; \
|
|
echo ".Python" >> .gitignore; \
|
|
echo "build/" >> .gitignore; \
|
|
echo "develop-eggs/" >> .gitignore; \
|
|
echo "dist/" >> .gitignore; \
|
|
echo "downloads/" >> .gitignore; \
|
|
echo "eggs/" >> .gitignore; \
|
|
echo ".eggs/" >> .gitignore; \
|
|
echo "lib/" >> .gitignore; \
|
|
echo "lib64/" >> .gitignore; \
|
|
echo "parts/" >> .gitignore; \
|
|
echo "sdist/" >> .gitignore; \
|
|
echo "var/" >> .gitignore; \
|
|
echo "wheels/" >> .gitignore; \
|
|
echo "*.egg-info/" >> .gitignore; \
|
|
echo ".installed.cfg" >> .gitignore; \
|
|
echo "*.egg" >> .gitignore; \
|
|
echo "MANIFEST" >> .gitignore; \
|
|
echo "" >> .gitignore; \
|
|
echo "# Virtual environments" >> .gitignore; \
|
|
echo ".env" >> .gitignore; \
|
|
echo ".venv" >> .gitignore; \
|
|
echo "env/" >> .gitignore; \
|
|
echo "venv/" >> .gitignore; \
|
|
echo "ENV/" >> .gitignore; \
|
|
echo "env.bak/" >> .gitignore; \
|
|
echo "venv.bak/" >> .gitignore; \
|
|
echo "" >> .gitignore; \
|
|
echo "# IDEs" >> .gitignore; \
|
|
echo ".vscode/" >> .gitignore; \
|
|
echo ".idea/" >> .gitignore; \
|
|
echo "*.swp" >> .gitignore; \
|
|
echo "*.swo" >> .gitignore; \
|
|
echo "*~" >> .gitignore; \
|
|
echo "" >> .gitignore; \
|
|
echo "# Testing" >> .gitignore; \
|
|
echo ".pytest_cache/" >> .gitignore; \
|
|
echo ".coverage" >> .gitignore; \
|
|
echo "htmlcov/" >> .gitignore; \
|
|
echo ".tox/" >> .gitignore; \
|
|
fi
|
|
@if [ ! -f "LICENSE" ]; then \
|
|
echo "Creating MIT LICENSE..."; \
|
|
echo "MIT License" > LICENSE; \
|
|
echo "" >> LICENSE; \
|
|
echo "Copyright (c) $$(date +%Y) Project Name" >> LICENSE; \
|
|
echo "" >> LICENSE; \
|
|
echo "Permission is hereby granted, free of charge, to any person obtaining a copy" >> LICENSE; \
|
|
echo "of this software and associated documentation files (the \"Software\"), to deal" >> LICENSE; \
|
|
echo "in the Software without restriction, including without limitation the rights" >> LICENSE; \
|
|
echo "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell" >> LICENSE; \
|
|
echo "copies of the Software, and to permit persons to whom the Software is" >> LICENSE; \
|
|
echo "furnished to do so, subject to the following conditions:" >> LICENSE; \
|
|
echo "" >> LICENSE; \
|
|
echo "The above copyright notice and this permission notice shall be included in all" >> LICENSE; \
|
|
echo "copies or substantial portions of the Software." >> LICENSE; \
|
|
echo "" >> LICENSE; \
|
|
echo "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" >> LICENSE; \
|
|
echo "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," >> LICENSE; \
|
|
echo "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" >> LICENSE; \
|
|
echo "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" >> LICENSE; \
|
|
echo "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," >> LICENSE; \
|
|
echo "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE" >> LICENSE; \
|
|
echo "SOFTWARE." >> LICENSE; \
|
|
fi
|
|
@echo "✅ Directory structure and basic files created"
|
|
|
|
# Configure Python package structure
|
|
setup-python: setup-structure ensure-project-structure
|
|
@echo "🐍 Configuring Python package structure..."
|
|
@if [ ! -d "src" ]; then mkdir -p src; fi
|
|
@# Determine package name from pyproject.toml or use default
|
|
@PACKAGE_NAME=$$(grep '^name = ' pyproject.toml 2>/dev/null | sed 's/name = "\(.*\)"/\1/' | tr '-' '_' || echo "project_name"); \
|
|
if [ ! -d "src/$$PACKAGE_NAME" ]; then \
|
|
echo "Creating src/$$PACKAGE_NAME package..."; \
|
|
mkdir -p "src/$$PACKAGE_NAME"; \
|
|
echo '"""Package initialization for '"$$PACKAGE_NAME"'."""' > "src/$$PACKAGE_NAME/__init__.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/__init__.py"; \
|
|
echo "__version__ = \"0.1.0\"" >> "src/$$PACKAGE_NAME/__init__.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/__init__.py"; \
|
|
echo "# Example core module" > "src/$$PACKAGE_NAME/core.py"; \
|
|
echo '"""Core functionality."""' >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "from typing import Optional" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "class ExampleClass:" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo ' """Example class demonstrating proper structure."""' >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " def __init__(self, name: str, value: Optional[int] = None) -> None:" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo ' """Initialize instance."""' >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " self.name = name" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " self.value = value or 0" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo "" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " def process(self, input_data: str) -> str:" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo ' """Process input data."""' >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " if not input_data.strip():" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo ' raise ValueError("Input data cannot be empty")' >> "src/$$PACKAGE_NAME/core.py"; \
|
|
echo " return f\"{self.name}: {input_data} (value: {self.value})\"" >> "src/$$PACKAGE_NAME/core.py"; \
|
|
fi
|
|
@echo "✅ Python package structure configured"
|
|
|
|
# Install and configure development tools
|
|
setup-tools: $(VENV)/bin/activate
|
|
@echo "🔧 Installing and configuring development tools..."
|
|
@$(VENV_PYTHON) -m pip install --upgrade pip
|
|
@$(VENV_PYTHON) -m pip install pytest black flake8 mypy
|
|
@echo "✅ Development tools installed and configured"
|
|
|
|
# Generate documentation framework
|
|
setup-docs: setup-structure
|
|
@echo "📚 Generating documentation framework..."
|
|
@if [ ! -f "README.md" ]; then \
|
|
echo "Creating README.md..."; \
|
|
PACKAGE_NAME=$$(grep '^name = ' pyproject.toml 2>/dev/null | sed 's/name = "\(.*\)"/\1/' || echo "Project Name"); \
|
|
echo "# $$PACKAGE_NAME" > README.md; \
|
|
echo "" >> README.md; \
|
|
echo "A Python project following PythonVibes best practices." >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "## Installation" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "\`\`\`bash" >> README.md; \
|
|
echo "# Clone the repository" >> README.md; \
|
|
echo "git clone <repository-url>" >> README.md; \
|
|
echo "cd $$PACKAGE_NAME" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "# Set up development environment" >> README.md; \
|
|
echo "make setup-complete" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "# Activate virtual environment" >> README.md; \
|
|
echo "source .venv/bin/activate" >> README.md; \
|
|
echo "\`\`\`" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "## Development" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "\`\`\`bash" >> README.md; \
|
|
echo "# Run tests" >> README.md; \
|
|
echo "make test" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "# Check code quality" >> README.md; \
|
|
echo "make lint" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "# Format code" >> README.md; \
|
|
echo "make format" >> README.md; \
|
|
echo "\`\`\`" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "## License" >> README.md; \
|
|
echo "" >> README.md; \
|
|
echo "MIT License - see LICENSE file for details." >> README.md; \
|
|
fi
|
|
@echo "✅ Documentation framework generated"
|
|
|
|
# Create testing infrastructure
|
|
setup-tests: setup-python
|
|
@echo "🧪 Creating testing infrastructure..."
|
|
@if [ ! -d "tests" ]; then mkdir -p tests; fi
|
|
@if [ ! -f "tests/__init__.py" ]; then \
|
|
echo "Creating tests/__init__.py..."; \
|
|
echo '"""Test package initialization."""' > tests/__init__.py; \
|
|
fi
|
|
@PACKAGE_NAME=$$(grep '^name = ' pyproject.toml 2>/dev/null | sed 's/name = "\(.*\)"/\1/' | tr '-' '_' || echo "project_name"); \
|
|
if [ ! -f "tests/test_core.py" ]; then \
|
|
echo "Creating tests/test_core.py..."; \
|
|
echo '"""Tests for core functionality."""' > tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo "import pytest" >> tests/test_core.py; \
|
|
echo "from $$PACKAGE_NAME.core import ExampleClass" >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo "class TestExampleClass:" >> tests/test_core.py; \
|
|
echo ' """Test cases for ExampleClass."""' >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo " def test_initialization(self):" >> tests/test_core.py; \
|
|
echo ' """Test ExampleClass initialization."""' >> tests/test_core.py; \
|
|
echo ' obj = ExampleClass("test")' >> tests/test_core.py; \
|
|
echo ' assert obj.name == "test"' >> tests/test_core.py; \
|
|
echo " assert obj.value == 0" >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo " def test_initialization_with_value(self):" >> tests/test_core.py; \
|
|
echo ' """Test ExampleClass initialization with value."""' >> tests/test_core.py; \
|
|
echo ' obj = ExampleClass("test", 42)' >> tests/test_core.py; \
|
|
echo ' assert obj.name == "test"' >> tests/test_core.py; \
|
|
echo " assert obj.value == 42" >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo " def test_process_valid_input(self):" >> tests/test_core.py; \
|
|
echo ' """Test process method with valid input."""' >> tests/test_core.py; \
|
|
echo ' obj = ExampleClass("test", 42)' >> tests/test_core.py; \
|
|
echo ' result = obj.process("hello")' >> tests/test_core.py; \
|
|
echo ' assert result == "test: hello (value: 42)"' >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo " def test_process_empty_input(self):" >> tests/test_core.py; \
|
|
echo ' """Test process method with empty input."""' >> tests/test_core.py; \
|
|
echo ' obj = ExampleClass("test")' >> tests/test_core.py; \
|
|
echo " with pytest.raises(ValueError, match=\"Input data cannot be empty\"):" >> tests/test_core.py; \
|
|
echo ' obj.process("")' >> tests/test_core.py; \
|
|
echo "" >> tests/test_core.py; \
|
|
echo " with pytest.raises(ValueError, match=\"Input data cannot be empty\"):" >> tests/test_core.py; \
|
|
echo ' obj.process(" ")' >> tests/test_core.py; \
|
|
fi
|
|
@echo "✅ Testing infrastructure created"
|
|
|
|
# Verify complete setup functionality
|
|
setup-verify: $(VENV)/bin/activate
|
|
@echo "🔍 Verifying complete setup functionality..."
|
|
@echo " • Checking virtual environment..."
|
|
@if [ -f "$(VENV)/bin/python" ]; then \
|
|
echo " ✅ Virtual environment active"; \
|
|
else \
|
|
echo " ❌ Virtual environment not found"; \
|
|
exit 1; \
|
|
fi
|
|
@echo " • Checking package structure..."
|
|
@PACKAGE_NAME=$$(grep '^name = ' pyproject.toml 2>/dev/null | sed 's/name = "\(.*\)"/\1/' | tr '-' '_' || echo "project_name"); \
|
|
if [ -f "src/$$PACKAGE_NAME/__init__.py" ] && [ -f "src/$$PACKAGE_NAME/core.py" ]; then \
|
|
echo " ✅ Package structure correct"; \
|
|
else \
|
|
echo " ❌ Package structure incomplete"; \
|
|
exit 1; \
|
|
fi
|
|
@echo " • Checking development tools..."
|
|
@if $(VENV_PYTHON) -c "import pytest, black, flake8, mypy" 2>/dev/null; then \
|
|
echo " ✅ Development tools installed"; \
|
|
else \
|
|
echo " ❌ Development tools missing"; \
|
|
exit 1; \
|
|
fi
|
|
@echo " • Running tests..."
|
|
@if $(VENV_PYTHON) -m pytest tests/ -v --tb=short; then \
|
|
echo " ✅ Tests pass"; \
|
|
else \
|
|
echo " ❌ Tests failing"; \
|
|
exit 1; \
|
|
fi
|
|
@echo " • Checking code quality..."
|
|
@if $(VENV_PYTHON) -m flake8 src/ --max-line-length=100 --show-source; then \
|
|
echo " ✅ Code quality checks pass"; \
|
|
else \
|
|
echo " ❌ Code quality issues found"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "✅ Setup verification complete! Repository ready for development."
|
|
|
|
# ============================================================================
|
|
# Development Targets
|
|
# ============================================================================
|
|
|
|
# Run tests (unit tests only - fast)
|
|
test: $(VENV)/bin/activate
|
|
@echo "🧪 Running unit tests..."
|
|
@if [ -f $(VENV)/bin/pytest ]; then \
|
|
PYTHONPATH=. $(VENV)/bin/pytest tests/ -v; \
|
|
else \
|
|
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
|
|
PYTHONPATH=. $(VENV_PYTHON) -m unittest discover tests/ -v; \
|
|
fi
|
|
|
|
# Run comprehensive test suite (tests + standards + quality)
|
|
test-all: standards-test test lint
|
|
@echo "🎯 Running comprehensive test suite..."
|
|
@$(MAKE) --no-print-directory test
|
|
@echo ""
|
|
@echo "✅ All tests completed successfully!"
|
|
@echo " • Unit tests: PASSED"
|
|
@echo " • Standards compliance: PASSED"
|
|
@echo " • Code quality: PASSED"
|
|
|
|
# Build the package
|
|
build: $(VENV)/bin/activate
|
|
@echo "🏗️ Building package..."
|
|
@$(VENV_PYTHON) -m build
|
|
@echo "✅ Package built successfully"
|
|
|
|
# Run code linting
|
|
lint: $(VENV)/bin/activate
|
|
@echo "🔍 Running linting..."
|
|
@if $(VENV_PYTHON) -c "import flake8" 2>/dev/null; then \
|
|
$(VENV_PYTHON) -m flake8 src/ --max-line-length=100 --show-source; \
|
|
echo "✅ Linting completed"; \
|
|
else \
|
|
echo "⚠️ flake8 not installed. Run 'make setup-tools' first."; \
|
|
fi
|
|
|
|
# Format code with black
|
|
format: $(VENV)/bin/activate
|
|
@echo "🎨 Formatting code with black..."
|
|
@if $(VENV_PYTHON) -c "import black" 2>/dev/null; then \
|
|
$(VENV_PYTHON) -m black src/ tests/; \
|
|
echo "✅ Code formatting completed"; \
|
|
else \
|
|
echo "⚠️ black not installed. Run 'make setup-tools' first."; \
|
|
fi
|
|
|
|
# Clean build artifacts and cache
|
|
clean:
|
|
@echo "🧹 Cleaning build artifacts and cache..."
|
|
@rm -rf build/ dist/ *.egg-info/ .pytest_cache/ __pycache__/ .coverage htmlcov/
|
|
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
@find . -type f -name "*.pyo" -delete 2>/dev/null || true
|
|
@echo "✅ Cleanup completed"
|
|
|
|
# ============================================================================
|
|
# Standards Compliance Targets
|
|
# ============================================================================
|
|
|
|
# Check repository against PythonVibes standards (read-only analysis)
|
|
standards-check:
|
|
@echo "🔍 Checking repository against PythonVibes standards..."
|
|
@echo ""
|
|
@echo "📋 Repository Structure Analysis:"
|
|
@echo "================================"
|
|
@ISSUES=0; \
|
|
echo " • Project Configuration:"; \
|
|
if [ -f "pyproject.toml" ]; then \
|
|
echo " ✅ pyproject.toml exists"; \
|
|
if grep -q '^\[build-system\]' pyproject.toml && grep -q '^name = ' pyproject.toml; then \
|
|
echo " ✅ pyproject.toml properly configured"; \
|
|
else \
|
|
echo " ⚠️ pyproject.toml missing required sections"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ pyproject.toml missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
echo ""; \
|
|
echo " • Directory Structure:"; \
|
|
if [ -d "src" ]; then \
|
|
echo " ✅ src/ directory exists"; \
|
|
PACKAGE_NAME=$$(grep '^name = ' pyproject.toml 2>/dev/null | sed 's/name = "\(.*\)"/\1/' | tr '-' '_' || echo ""); \
|
|
if [ -n "$$PACKAGE_NAME" ] && [ -d "src/$$PACKAGE_NAME" ]; then \
|
|
echo " ✅ Package directory src/$$PACKAGE_NAME exists"; \
|
|
if [ -f "src/$$PACKAGE_NAME/__init__.py" ]; then \
|
|
echo " ✅ Package __init__.py exists"; \
|
|
else \
|
|
echo " ❌ Package __init__.py missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ Package directory missing or misnamed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ src/ directory missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if [ -d "tests" ]; then \
|
|
echo " ✅ tests/ directory exists"; \
|
|
if [ -f "tests/__init__.py" ]; then \
|
|
echo " ✅ tests/__init__.py exists"; \
|
|
else \
|
|
echo " ⚠️ tests/__init__.py missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ tests/ directory missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if [ -d "docs" ]; then \
|
|
echo " ✅ docs/ directory exists"; \
|
|
else \
|
|
echo " ⚠️ docs/ directory missing"; \
|
|
fi; \
|
|
echo ""; \
|
|
echo " • Essential Files:"; \
|
|
for file in README.md LICENSE .gitignore; do \
|
|
if [ -f "$$file" ]; then \
|
|
echo " ✅ $$file exists"; \
|
|
else \
|
|
echo " ❌ $$file missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
done; \
|
|
echo ""; \
|
|
echo " • Development Tools:"; \
|
|
if [ -f "$(VENV)/bin/python" ]; then \
|
|
echo " ✅ Virtual environment active"; \
|
|
if $(VENV_PYTHON) -c "import pytest" 2>/dev/null; then \
|
|
echo " ✅ pytest installed"; \
|
|
else \
|
|
echo " ❌ pytest not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if $(VENV_PYTHON) -c "import black" 2>/dev/null; then \
|
|
echo " ✅ black installed"; \
|
|
else \
|
|
echo " ❌ black not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if $(VENV_PYTHON) -c "import flake8" 2>/dev/null; then \
|
|
echo " ✅ flake8 installed"; \
|
|
else \
|
|
echo " ❌ flake8 not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ Virtual environment not found"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
echo ""; \
|
|
echo " • Code Quality:"; \
|
|
if [ -d "src" ] && [ -f "$(VENV)/bin/python" ]; then \
|
|
if $(VENV_PYTHON) -m flake8 src/ --max-line-length=100 --show-source >/dev/null 2>&1; then \
|
|
echo " ✅ Code passes flake8 checks"; \
|
|
else \
|
|
echo " ⚠️ Code has flake8 violations"; \
|
|
fi; \
|
|
if [ -d "tests" ] && $(VENV_PYTHON) -m pytest tests/ --tb=no -q >/dev/null 2>&1; then \
|
|
echo " ✅ Tests pass"; \
|
|
else \
|
|
echo " ⚠️ Tests failing or missing"; \
|
|
fi; \
|
|
fi; \
|
|
echo ""; \
|
|
echo "📊 Standards Compliance Summary:"; \
|
|
echo "==============================="; \
|
|
if [ $$ISSUES -eq 0 ]; then \
|
|
echo "🎉 Repository fully complies with PythonVibes standards!"; \
|
|
echo " All essential components are properly configured."; \
|
|
elif [ $$ISSUES -le 3 ]; then \
|
|
echo "⚠️ Repository mostly complies with minor issues ($$ISSUES violations)"; \
|
|
echo " Run 'make standards-fix' to address these issues."; \
|
|
else \
|
|
echo "❌ Repository has significant standards violations ($$ISSUES issues)"; \
|
|
echo " Run 'make standards-fix' to bring repository up to standards."; \
|
|
fi; \
|
|
echo ""; \
|
|
echo "💡 Next steps:"; \
|
|
echo " • Run 'make standards-fix' to automatically fix issues"; \
|
|
echo " • Use agent-setupRepository.md for manual guidance"; \
|
|
echo " • Check individual components with specific setup-* targets"
|
|
|
|
# Fix standards violations (idempotent setup)
|
|
standards-fix: setup-complete
|
|
@echo "🔧 Fixed any standards violations found."
|
|
@echo " Repository now complies with PythonVibes standards."
|
|
@echo ""
|
|
@echo "🔍 Run 'make standards-check' to verify compliance."
|
|
|
|
# Run repository standards compliance tests
|
|
standards-test: $(VENV)/bin/activate
|
|
@echo "🔍 Running repository standards compliance tests..."
|
|
@echo ""
|
|
@ISSUES=0; \
|
|
echo "📋 Testing Repository Standards:"; \
|
|
echo "==============================="; \
|
|
echo " • Project Configuration:"; \
|
|
if [ -f "pyproject.toml" ]; then \
|
|
if grep -q '^\[build-system\]' pyproject.toml && grep -q '^name = ' pyproject.toml; then \
|
|
echo " ✅ pyproject.toml properly configured"; \
|
|
else \
|
|
echo " ❌ pyproject.toml missing required sections"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
else \
|
|
echo " ❌ pyproject.toml missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
echo " • Directory Structure:"; \
|
|
if [ -d "src" ]; then \
|
|
echo " ✅ src/ directory exists"; \
|
|
else \
|
|
echo " ❌ src/ directory missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if [ -d "tests" ]; then \
|
|
echo " ✅ tests/ directory exists"; \
|
|
else \
|
|
echo " ❌ tests/ directory missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
echo " • Essential Files:"; \
|
|
for file in README.md LICENSE .gitignore; do \
|
|
if [ -f "$$file" ]; then \
|
|
echo " ✅ $$file exists"; \
|
|
else \
|
|
echo " ❌ $$file missing"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
done; \
|
|
echo " • Development Tools:"; \
|
|
if $(VENV_PYTHON) -c "import pytest" 2>/dev/null; then \
|
|
echo " ✅ pytest installed"; \
|
|
else \
|
|
echo " ❌ pytest not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if $(VENV_PYTHON) -c "import black" 2>/dev/null; then \
|
|
echo " ✅ black installed"; \
|
|
else \
|
|
echo " ❌ black not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
if $(VENV_PYTHON) -c "import flake8" 2>/dev/null; then \
|
|
echo " ✅ flake8 installed"; \
|
|
else \
|
|
echo " ❌ flake8 not installed"; \
|
|
ISSUES=$$((ISSUES + 1)); \
|
|
fi; \
|
|
echo ""; \
|
|
if [ $$ISSUES -eq 0 ]; then \
|
|
echo "✅ Repository standards compliance: PASSED"; \
|
|
else \
|
|
echo "❌ Repository standards compliance: FAILED ($$ISSUES violations)"; \
|
|
echo " Run 'make standards-fix' to resolve issues."; \
|
|
exit 1; \
|
|
fi
|