Skip to content

Feature: Lazy loading of cloud provider dependencies #14816

@dguido

Description

@dguido

Problem

Currently, Algo installs all cloud provider dependencies upfront, even when users only deploy to one provider. This increases:

  • Installation time and disk space usage
  • Dependency complexity and potential conflicts
  • Attack surface with unused libraries

Example: A user deploying only to DigitalOcean still gets AWS boto3, Google Cloud SDK, Azure libraries, etc.

Proposed Solution

Implement lazy loading where cloud provider dependencies are installed only when needed:

algo digitalocean  # Only installs python-digitalocean
algo aws          # Only installs boto3, awscli  
algo gcp          # Only installs google-cloud libraries
algo azure        # Only installs azure libraries
algo local        # No cloud deps needed

Implementation Ideas

Option 1: Dynamic Installation

  • Detect cloud provider from user selection
  • Install required packages with uv add during deployment
  • Cache installed packages for subsequent runs

Option 2: Optional Dependencies Groups

# pyproject.toml
[project.optional-dependencies]
aws = ["boto3>=1.34.0", "awscli>=1.32.0"]
gcp = ["google-cloud-compute>=1.15.0", "google-auth>=2.25.0"]  
azure = ["azure-mgmt-compute>=30.0.0", "azure-identity>=1.15.0"]
digitalocean = ["python-digitalocean>=1.17.0"]

Then: uv sync --extra aws or uv sync --extra gcp

Option 3: Provider Detection

  • Auto-detect from config.cfg provider selection
  • Install dependencies just-in-time during deployment
  • Provide clear error messages if packages missing

Benefits

  1. Faster installation - Only install what you need
  2. Smaller footprint - Reduce disk usage and memory consumption
  3. Better security - Fewer dependencies = smaller attack surface
  4. Cleaner UX - Users see only relevant provider-specific prompts/errors

Considerations

  • Backward compatibility with existing workflows
  • Graceful handling of network issues during dynamic installation
  • Clear documentation for offline/airgapped deployments
  • CI/CD pipeline adjustments for testing all providers

Related

This aligns with modern package management best practices (see npm's optional dependencies, Python's extras, Go's module system).


This issue was created as part of AlgoVPN 2.0 packaging improvements.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions