KEY INSIGHT
Local AI products have unconventional distribution requirements—large download sizes, hardware dependency verification, platform-specific dependencies. Your distribution channel strategy must adapt to these constraints while reaching your target users.
Traditional SaaS distribution (npm install, pip install) works for developers. But your non-technical users need installer experiences that handle hardware verification, dependency installation (CUDA, Xcode command line tools), and model download management.
```python
# distribution_manager.py
import hashlib
import os
from dataclasses import dataclass
from typing import List, Dict, Optional
import platform
@dataclass
class DistributionChannel:
channel_id: str
platform: str # 'macos', 'windows', 'linux'
installer_type: str # 'dmg', 'msi', 'deb', 'appimage', 'binary'
min_version: str
download_size_gb: float
checksum: str # SHA256
model_download_strategy: str # 'bundled', 'separate', 'ondemand'
@dataclass
class Release:
version: str
channels: List[DistributionChannel]
changelog: str
release_date: str
class DistributionManager:
def __init__(self, product_name: str):
self.product_name = product_name
self.current_platform = platform.system().lower()
def get_current_platform_channel(self, release: Release) -> Optional[DistributionChannel]:
"""Get appropriate distribution channel for current platform."""
platform_map = {
'darwin': 'macos',
'windows': 'windows',
'linux': 'linux'
}
mapped_platform = platform_map.get(self.current_platform)
if not mapped_platform:
return None
return next(
(c for c in release.channels if c.platform == mapped_platform),
None
)
def prepare_bundled_release(self, release: Release, model_manifest: dict) -> dict:
"""
Prepare release with bundled model strategy.
For users with limited bandwidth who prefer single download.
"""
channel = self.get_current_platform_channel(release)
if not channel:
raise ValueError(f"Unsupported platform: {self.current_platform}")
# Calculate total size with model bundle
base_size = channel.download_size_gb
bundled_size = sum(
config['size_gb'] for config in model_manifest.values()
if config.get('bundled', False)
)
return {
'release': release,
'channel': channel,
'total_download_gb': base_size + bundled_size,
'includes': [k for k, v in model_manifest.items() if v.get('bundled')],
'download_url': f"https://releases.{self.product_name}.com/{release.version}/{channel.installer_type}",
'checksum': channel.checksum,
'verification_instructions': self._get_verification_instructions(channel)
}
def prepare_ondemand_release(self, release: Release, model_manifest: dict) -> dict:
"""
Prepare release with on-demand model downloading.
Smaller installer, user selects models to download.
"""
channel = self.get_current_platform_channel(release)
return {
'release': release,
'channel': channel,
'base_installer_gb': channel.download_size_gb,
'available_models': [
{
'id': k,
'name': v['display_name'],
'size_gb': v['size_gb'],
'requirements': v.get('requirements', {}),
'capabilities': v.get('capabilities', [])
}
for k, v in model_manifest.items()
],
'download_url': f"https://releases.{self.product_name}.com/{release.version}/{channel.installer_type}"
}
def _get_verification_instructions(self, channel: DistributionChannel) -> str:
return f"""
Download verification:
1. Download the installer
2. Compute checksum: shasum -a 256 {self.product_name}.{channel.installer_type}
3. Verify checksum matches: {channel.checksum}
4. Proceed with installation
"""
```
Consider release frequency carefully. Local models with bundled downloads mean every release includes model updates. Segmented on-demand downloads let you update models without forcing reinstalls—which users will appreciate.