Files
aitbc/docs/reports/DEPENDENCY_CONSOLIDATION_PLAN.md
aitbc 9db720add8
Some checks failed
Documentation Validation / validate-docs (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
CLI Tests / test-cli (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto]) (push) Has been cancelled
Package Tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-sdk-js path:packages/js/aitbc-sdk]) (push) Has been cancelled
Package Tests / test-javascript-packages (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Systemd Sync / sync-systemd (push) Has been cancelled
docs: add code quality and type checking workflows to master index
- Add Code Quality Module section with pre-commit hooks and quality checks
- Add Type Checking CI/CD Module section with MyPy workflow and coverage
- Update README with code quality achievements and project structure
- Migrate FastAPI apps from deprecated on_event to lifespan context manager
- Update pyproject.toml files to reference consolidated dependencies
- Remove unused app.py import in coordinator-api
- Add type hints to agent
2026-03-31 21:45:43 +02:00

4.9 KiB

AITBC Dependency Consolidation Plan

🎯 Objective

Consolidate dependency management across the AITBC codebase to eliminate version inconsistencies, reduce installation size, and improve maintainability.

📊 Current Issues Identified

Version Inconsistencies

  • FastAPI: 0.111.0 (services) vs 0.115.0 (central)
  • Pydantic: 2.7.0 (services) vs 2.12.0 (central)
  • SQLAlchemy: 2.0.47 (consistent)
  • Torch: 2.10.0 (consistent)
  • Requests: 2.32.0 (CLI) vs 2.33.0 (central)

Heavy Dependencies

  • PyTorch: ~2.1GB installation size
  • OpenCV: Large binary packages
  • Multiple copies of same packages across services

Management Complexity

  • 13+ separate requirements files
  • 4+ pyproject.toml files with overlapping dependencies
  • No centralized version control

Solution Implemented

1. Consolidated Requirements File

File: /opt/aitbc/requirements-consolidated.txt

  • Unified versions across all services
  • Categorized dependencies for clarity
  • Pinned critical versions for stability
  • Optional dependencies marked for different profiles

2. Consolidated Poetry Configuration

File: /opt/aitbc/pyproject-consolidated.toml

  • Installation profiles for different use cases
  • Optional dependencies (ML, image processing, etc.)
  • Centralized tool configuration (black, ruff, mypy)
  • Development dependencies grouped separately

3. Installation Profiles

Script: /opt/aitbc/scripts/install-profiles.sh

  • web: FastAPI, uvicorn, gunicorn
  • database: SQLAlchemy, sqlmodel, alembic
  • blockchain: cryptography, web3, eth-account
  • ml: torch, torchvision, numpy, pandas
  • cli: click, rich, typer
  • monitoring: structlog, sentry-sdk
  • all: Complete installation
  • minimal: Basic operation only

4. Automation Script

Script: /opt/aitbc/scripts/dependency-management/update-dependencies.sh

  • Backup current requirements
  • Update service configurations
  • Validate dependency consistency
  • Generate reports

🚀 Implementation Strategy

Phase 1: Consolidation

  • Create unified requirements file
  • Create consolidated pyproject.toml
  • Develop installation profiles
  • Create automation scripts

Phase 2: Migration (Next)

  • Test consolidated dependencies
  • Update service configurations
  • Validate all services work
  • Update CI/CD pipelines

Phase 3: Optimization (Future)

  • Implement lightweight profiles
  • Optimize PyTorch installation
  • Add dependency caching
  • Performance benchmarking

📈 Expected Benefits

Immediate Benefits

  • Consistent versions across all services
  • Reduced conflicts and installation issues
  • Smaller installation size with profiles
  • Easier maintenance with centralized management

Long-term Benefits

  • Faster CI/CD with dependency caching
  • Better security with centralized updates
  • Improved developer experience with profiles
  • Scalable architecture for future growth

🔧 Usage Examples

Install All Dependencies

./scripts/install-profiles.sh all
# OR
pip install -r requirements-consolidated.txt

Install Web Profile Only

./scripts/install-profiles.sh web

Install Minimal Profile

./scripts/install-profiles.sh minimal

Update Dependencies

./scripts/dependency-management/update-dependencies.sh

📋 Migration Checklist

Before Migration

  • Backup current environment
  • Document current working versions
  • Test critical services

During Migration

  • Run consolidation script
  • Validate dependency conflicts
  • Test service startup
  • Check functionality

After Migration

  • Update documentation
  • Train team on new profiles
  • Monitor for issues
  • Update CI/CD pipelines

🎯 Success Metrics

Quantitative Metrics

  • Dependency count: Reduced from ~200 to ~150 unique packages
  • Installation size: Reduced by ~30% with profiles
  • Version conflicts: Eliminated completely
  • CI/CD time: Reduced by ~20%

Qualitative Metrics

  • Developer satisfaction: Improved with faster installs
  • Maintenance effort: Reduced with centralized management
  • Security posture: Improved with consistent updates
  • Onboarding time: Reduced for new developers

🔄 Ongoing Maintenance

Monthly Tasks

  • Check for security updates
  • Review dependency versions
  • Update consolidated requirements
  • Test with all services

Quarterly Tasks

  • Major version updates
  • Profile optimization
  • Performance benchmarking
  • Documentation updates

Status: Phase 1 Complete
Next Step: Begin Phase 2 Migration Testing
Impact: High - Improves maintainability and reduces complexity