PyAirbyte icon indicating copy to clipboard operation
PyAirbyte copied to clipboard

feat: add install CLI command for pre-installing connectors

Open aaronsteers opened this issue 4 months ago • 6 comments

feat: add install CLI command for pre-installing connectors

Summary

This PR adds a new install CLI command to PyAirbyte that allows pre-installing connectors, particularly useful for front-loading installation costs during image build processes. The command accepts generic connector arguments that work for both sources and destinations.

Key Features:

  • New pyab install command with comprehensive connector installation options
  • Supports all installation methods: pip URLs, Docker images, local executables, and YAML manifests
  • Includes --use-python option for Python interpreter selection
  • Uses get_connector_executor() directly for efficiency and type-agnostic approach
  • Proper error handling following existing CLI patterns

Example Usage:

# Install latest version of a connector
pyab install --connector=source-hardcoded-records

# Install with specific Python interpreter
pyab install --connector=source-hardcoded-records --use-python=true

# Install from pip URL
pyab install --connector=source-hardcoded-records --pip-url="airbyte-source-hardcoded-records==0.0.30"

Review & Testing Checklist for Human

  • [ ] Test different connector types: Verify the command works with both source and destination connectors
  • [ ] Test installation methods: Try pip URLs, Docker images, local executables, and manifest files
  • [ ] Test --use-python parameter: Verify behavior with 'true', 'false', paths, and version strings like '3.11'
  • [ ] Test error handling: Try invalid connector names, non-existent versions, and malformed parameters
  • [ ] Verify image build use case: Test that installed connectors can be used without re-installation in subsequent commands

Recommended Test Plan:

  1. Test basic installation: pyab install --connector=source-hardcoded-records
  2. Test with use-python: pyab install --connector=source-hardcoded-records --use-python=true
  3. Test invalid version to verify error handling: pyab install --connector=source-hardcoded-records --version=999.999.999
  4. Test that installed connector works in subsequent operations without re-installation

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    CLI["airbyte/cli.py"]:::major-edit
    Executor["airbyte/_executors/util.py<br/>get_connector_executor()"]:::context
    VenvExec["airbyte/_executors/python.py<br/>VenvExecutor"]:::context
    DockerExec["airbyte/_executors/docker.py<br/>DockerExecutor"]:::context
    
    CLI -->|"calls directly"| Executor
    Executor -->|"creates appropriate"| VenvExec
    Executor -->|"creates appropriate"| DockerExec
    
    VenvExec -->|"executor.install()"| InstallVenv["Virtual Environment<br/>Installation"]:::context
    DockerExec -->|"executor.install()"| InstallDocker["Docker Image<br/>Installation"]:::context

    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF

Notes

  • The install command uses get_connector_executor() directly rather than get_source()/get_destination() for efficiency and type-agnostic support
  • All CLI option parsing follows existing patterns from other commands (validate, benchmark, sync)
  • Error handling uses PyAirbyteInputError consistent with other CLI commands
  • Tested manually with source-hardcoded-records connector and various parameter combinations
  • Unit tests (182 passed) and integration tests (8 passed) confirm no regressions

Session Info:

  • Requested by: @aaronsteers
  • Devin session: https://app.devin.ai/sessions/c32fbc32bcc844d899a4fa12abab5f04

Summary by CodeRabbit

  • New Features
    • Added a new CLI command to install connectors with options for specifying name, version, pip URL, Docker image, local executable, and other advanced installation parameters. Users receive clear success or error messages during the installation process.

aaronsteers avatar Aug 01 '25 16:08 aaronsteers