This guide provides comprehensive instructions for installing SAFLA (Self-Aware Feedback Loop Algorithm) with its modular installation structure and rich UI components.
- Quick Installation
- Interactive Installation
- Development Installation
- Package Structure
- Configuration
- Validation
- Troubleshooting
- Building from Source
- Python 3.8 or higher
- pip (Python package installer)
- Operating System: Windows, macOS, or Linux
- Memory: Minimum 512MB RAM
- Disk Space: At least 100MB free space
pip install saflapip install git+https://github.com/ruvnet/SAFLA.gitsafla validateSAFLA provides an interactive installer with rich UI components for a guided setup experience.
pip install saflasafla-installThe interactive installer provides:
- System Requirements Validation: Checks Python version, OS compatibility, and available resources
- Dependency Checking: Validates all required dependencies are properly installed
- Configuration Setup: Guides through initial configuration options
- Progress Tracking: Rich progress bars and status indicators
- Installation Verification: Comprehensive validation of the installation
- Error Handling: Clear error messages and resolution suggestions
- Welcome Screen: Introduction and overview of the installation process
- System Check: Validation of system requirements and compatibility
- Dependency Installation: Automatic installation of required dependencies
- Configuration: Setup of initial configuration files and settings
- Validation: Comprehensive testing of the installation
- Completion: Summary of installation results and next steps
For developers who want to contribute to SAFLA or modify the source code.
git clone https://github.com/ruvnet/SAFLA.git
cd SAFLA# Install in editable mode with development dependencies
pip install -e ".[dev]"# Install dependencies manually
pip install -r requirements.txt
# Install development dependencies
pip install -r requirements-dev.txt# Copy environment template
cp .env.example .env
# Edit configuration (use your preferred editor)
nano .env# Run all tests
python -m pytest tests/
# Run with coverage
python -m pytest --cov=safla tests/
# Run specific test files
python -m pytest tests/test_installation.pyThe SAFLA package follows modern Python packaging standards:
safla/
├── __init__.py # Main package exports and metadata
├── cli.py # Command-line interface with rich UI
├── installer.py # Interactive installer with progress tracking
├── exceptions.py # Custom exception hierarchy
└── utils/
├── __init__.py # Utilities package
├── config.py # Configuration management
├── logging.py # Logging utilities with rich formatting
└── validation.py # System and installation validation
scripts/
├── install.py # Standalone installation script
└── build.py # Package build script
tests/
└── test_installation.py # Installation validation tests
Configuration Files:
├── pyproject.toml # Primary packaging configuration (PEP 621)
├── setup.py # Backward compatibility setup script
├── setup.cfg # Additional packaging configuration
├── requirements.txt # Package dependencies
├── MANIFEST.in # Distribution file inclusion rules
└── py.typed # Type hints marker file
SAFLA supports multiple configuration methods:
Create ~/.safla/config.yaml:
# SAFLA Configuration
log_level: "INFO"
enable_monitoring: true
max_iterations: 1000
convergence_threshold: 0.001
# Memory settings
memory:
max_size: 1000000000 # 1GB
cleanup_threshold: 0.8
# Safety settings
safety:
enable_constraints: true
emergency_stop_threshold: 0.95# Core settings
export SAFLA_LOG_LEVEL="INFO"
export SAFLA_ENABLE_MONITORING="true"
export SAFLA_MAX_ITERATIONS="1000"
# Memory settings
export SAFLA_MEMORY_MAX_SIZE="1000000000"
export SAFLA_MEMORY_CLEANUP_THRESHOLD="0.8"
# Safety settings
export SAFLA_SAFETY_ENABLE_CONSTRAINTS="true"
export SAFLA_SAFETY_EMERGENCY_STOP_THRESHOLD="0.95"from safla.utils.config import SAFLAConfig
config = SAFLAConfig(
log_level="INFO",
enable_monitoring=True,
max_iterations=1000,
convergence_threshold=0.001
)safla config interactiveSAFLA includes comprehensive validation capabilities:
# Validate entire system
safla validate
# Validate specific components
safla validate --component memory
safla validate --component safety
safla validate --component configfrom safla.utils.validation import validate_installation, validate_system_requirements
# Validate installation
is_valid, issues = validate_installation()
if not is_valid:
print("Installation issues:", issues)
# Validate system requirements
requirements_met, missing = validate_system_requirements()
if not requirements_met:
print("Missing requirements:", missing)- Python Version: Ensures Python 3.8+ is installed
- Dependencies: Validates all required packages are available
- System Resources: Checks available memory and disk space
- Configuration: Validates configuration files and settings
- Permissions: Ensures proper file and directory permissions
- Package Integrity: Verifies package files and structure
Error: Python version 3.7 is not supported
Solution:
# Check Python version
python --version
# Install Python 3.8+ or use pyenv
pyenv install 3.9.0
pyenv global 3.9.0Error: Failed to install required dependencies
Solution:
# Update pip
pip install --upgrade pip
# Install dependencies manually
pip install -r requirements.txt
# Use conda if pip fails
conda install -c conda-forge rich click pydanticError: Permission denied when creating configuration directory
Solution:
# Create directory manually
mkdir -p ~/.safla
# Set proper permissions
chmod 755 ~/.safla
# Run installer with user permissions
safla-install --userError: Invalid configuration format
Solution:
# Validate configuration
safla config validate
# Reset to defaults
safla config reset
# Use interactive configuration
safla config interactiveEnable debug mode for detailed troubleshooting:
# Set debug environment variable
export SAFLA_DEBUG=true
# Run with debug logging
safla --debug validate
# Run installer with debug output
safla-install --debug# Show help for main command
safla --help
# Show help for specific commands
safla validate --help
safla config --help
# Show version information
safla --versionFor advanced users who want to build the package from source:
# Install build tools
pip install build twine wheel# Clone repository
git clone https://github.com/ruvnet/SAFLA.git
cd SAFLA
# Clean previous builds
python scripts/build.py
# Or build manually
python -m buildThe build script (scripts/build.py) provides:
- Artifact Cleaning: Removes previous build artifacts
- Source Distribution: Creates
.tar.gzsource distribution - Wheel Distribution: Creates
.whlbinary distribution - Package Validation: Validates built packages with twine
- Rich UI: Progress indicators and formatted output
# Clean build artifacts
rm -rf build/ dist/ *.egg-info/
# Build source distribution
python -m build --sdist
# Build wheel distribution
python -m build --wheel
# Validate packages
python -m twine check dist/*# Test upload to TestPyPI
python -m twine upload --repository testpypi dist/*
# Upload to PyPI
python -m twine upload dist/*# Create virtual environment
python -m venv safla-env
# Activate (Linux/macOS)
source safla-env/bin/activate
# Activate (Windows)
safla-env\Scripts\activate
# Install SAFLA
pip install saflaFROM python:3.9-slim
# Install SAFLA
RUN pip install safla
# Set working directory
WORKDIR /app
# Run validation
RUN safla validate
CMD ["safla", "--help"]# Create conda environment
conda create -n safla python=3.9
# Activate environment
conda activate safla
# Install SAFLA
pip install saflaAfter successful installation:
- Validate Installation: Run
safla validateto ensure everything is working - Configure System: Use
safla config interactivefor initial setup - Read Documentation: Check the main documentation for usage examples
- Run Examples: Try the examples in the
examples/directory - Join Community: Participate in discussions and contribute to the project
- Documentation: README.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@safla.dev (if available)
This installation guide covers the modular installation structure for SAFLA with rich UI components and comprehensive validation.