# proteinverse/slivka-bio-installer architecture

> Architecture diagram of the GitHub repository proteinverse/slivka-bio-installer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/proteinverse/slivka-bio-installer
- Repository: https://github.com/proteinverse/slivka-bio-installer

## Overview

##### Project Type and Purpose
- This is an open-source, CLI-based installer for bioinformatics “services” (tools).
- It automates creating Conda environments or Docker images, then generates Slivka service definitions and optionally publishes them.

##### File Structure Analysis
– install.py: the Python-Click entry point (CLI).
– services/: each subfolder is a “plugin” containing:
- Conda YAML (environment spec)
- Dockerfile or Docker YAML (container spec)
- Slivka service YAML (service metadata)
- Optional scripts (build wrappers) and testdata.
– shared/: reusable scripts & common Slivka profiles.
– test/: unit tests and sample resource files (validates install.py logic and parsing).

##### README Insights
– Dependencies: Python, click (CLI), ruamel.yaml (YAML parser), slivka (service API), plus Conda & Docker CLIs.
– Workflow: clone with submodules → run `python install.py <target>` → interactive prompts for each service → execute Conda or Docker builds → generate or push Slivka service YAMLs.

a. Main Components
- CLI Interface (install.py + click)
- Core Installer Engine
– Service Discovery Module (scans services/ directory)
– Config Parser Module (loads .conda.yaml, .docker.yaml, .service.yaml using ruamel.yaml)
– Execution Engine (invokes Conda CLI or Docker CLI; optionally runs custom build scripts)
– Service Generator (emits final Slivka YAML definitions, uses shared/_profiles.yaml)
- Shared Scripts Library (shared/scripts/run_with_docker.sh, shared/services/_profiles.yaml)
- Service Definitions (YAML files under services/)
- External Dependencies
– Conda CLI
– Docker CLI
– Slivka Server or Registry (for publishing services)
- Test Suite (pytest harness under test/)

b. Relationships & Data Flow
1. User invokes CLI →
2. CLI calls Core Installer Engine →
3. Discovery Module enumerates every services/<tool-version> folder →
4. Config Parser loads each tool’s Conda/Docker/Service YAML →
5. Execution Engine chooses method (Conda vs. Docker), calls External CLI, optionally runs plugin scripts →
6. Service Generator writes Slivka service YAML to target directory or pushes to Slivka Server →
7. Test Suite can invoke the CLI in dry-run or real mode, validate generated configs.

c. Architectural Patterns & Principles
– Plugin Architecture: each service is a self-contained plugin folder that “plugs in” automatically.
– Separation of Concerns:
- Discovery vs. Parsing vs. Execution vs. Generation.
- Shared logic abstracted into shared/
– Config-Driven Design: YAML files drive both build configuration and service metadata.

d. Key Technologies & Frameworks
– Python 3.10, click (CLI), ruamel.yaml (YAML)
– Conda package manager
– Docker Engine
– Slivka (bio-service API & registry)
– PyTest (unit tests)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Interface
    CLI["CLI Interface<br>(install.py)"]:::internal
    click CLI "https://github.com/proteinverse/slivka-bio-installer/blob/main/install.py"

    %% Core Installer Engine
    subgraph "Core Installer Engine"
        %% Service Discovery
        Disc["Service Discovery Module"]:::internal
        click Disc "https://github.com/proteinverse/slivka-bio-installer/tree/main/services/"

        %% Config Parser
        Parser["Config Parser Module"]:::internal
        click Parser "https://github.com/proteinverse/slivka-bio-installer/blob/main/install.py"
        click Parser "https://github.com/proteinverse/slivka-bio-installer/blob/main/services/*/*.conda.yaml"
        click Parser "https://github.com/proteinverse/slivka-bio-installer/blob/main/services/*/*.docker.yaml"
        click Parser "https://github.com/proteinverse/slivka-bio-installer/blob/main/services/*/*.service.yaml"

        %% Execution Engine
        Exec["Execution Engine"]:::internal
        click Exec "https://github.com/proteinverse/slivka-bio-installer/blob/main/install.py"
        click Exec "https://github.com/proteinverse/slivka-bio-installer/blob/main/shared/scripts/run_with_docker.sh"
        click Exec "https://github.com/proteinverse/slivka-bio-installer/tree/main/services/*/scripts/"

        %% Service Generator
        Gen["Service Generator"]:::internal
        click Gen "https://github.com/proteinverse/slivka-bio-installer/blob/main/install.py"
        click Gen "https://github.com/proteinverse/slivka-bio-installer/blob/main/shared/services/_profiles.yaml"
    end

    %% Shared Scripts Library
    Shared["Shared Scripts Library"]:::internal
    click Shared "https://github.com/proteinverse/slivka-bio-installer/blob/main/shared/scripts/run_with_docker.sh"
    click Shared "https://github.com/proteinverse/slivka-bio-installer/blob/main/shared/services/_profiles.yaml"

    %% Service Plugins
    Services["Service Plugin<br>(services/<tool>-<version>)"]:::data
    click Services "https://github.com/proteinverse/slivka-bio-installer/tree/main/services/<tool>-<version>/"

    %% Test Suite
    TestSuite["Test Suite"]:::internal
    click TestSuite "https://github.com/proteinverse/slivka-bio-installer/blob/main/test/install_test.py"
    click TestSuite "https://github.com/proteinverse/slivka-bio-installer/tree/main/test/resources/data_dirs/"

    %% External Dependencies
    Conda["Conda CLI"]:::external
    Docker["Docker CLI"]:::external
    Slivka["Slivka Server/Registry"]:::external

    %% Flows
    CLI -->|"invokes"| Disc
    Disc -->|"discovers plugins"| Parser
    Parser -->|"parses YAML specs"| Exec
    Exec -->|"calls"| Conda
    Exec -->|"calls"| Docker
    Exec -->|"uses scripts"| Shared
    Exec -->|"builds plugins"| Services
    Exec -->|"triggers generator"| Gen
    Gen -->|"generates YAML"| Services
    Gen -->|"pushes to"| Slivka

    TestSuite -->|"tests CLI and flows"| CLI
    TestSuite -->|"validates generated configs"| Services

    %% Styling
    classDef internal fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef data fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#F08080,stroke:#000,stroke-width:1px
```
