# himsheda/python_koans architecture

> Architecture diagram of the GitHub repository himsheda/python_koans, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/himsheda/python_koans
- Repository: https://github.com/himsheda/python_koans

## Overview

##### Main Components

a. Core Components:
- Test Runner System
- Koans Module Collection
- Helper Libraries
- User Interface Layer (Command-line)

**User Interface Layer**

**Test Runner Layer**

**Koans Layer**

**Support Libraries Layer**

##### Specific Component Details

a. User Interface Layer:
- Entry points: contemplate_koans.py
- Alternative entry: scent.py (for Sniffer support)
- Command-line interface components

b. Test Runner Layer (runner/ directory):
- Mountain (runner/mountain.py)
- Sensei (runner/sensei.py)
- Path to Enlightenment (runner/path_to_enlightenment.py)
- Helper utilities (runner/helper.py)

c. Koans Layer (koans/ directory):
- Individual koan modules (about_*.py files)
- Supporting modules (triangle.py, local_module.py, etc.)
- Package examples (a_package_folder)

d. Support Libraries Layer (libs/ directory):
- Colorama for terminal output
- Mock testing support

##### Relationships and Flows

- Test execution flow
- Module dependencies
- User interaction flow

**┌─────────┐**
- Module  │ - Primary components
- ┘

**↓ - Execution flow**
**→ - Dependencies**
**⟲ - TDD cycle**

##### Implementation Notes

- The educational nature of the system
- The progressive learning path
- The test-driven development cycle
- The feedback mechanism

##### Key Interactions to Highlight

- User input → Test Runner → Koan execution
- Test Results → Sensei → User feedback
- Progressive advancement through koans
- Sniffer integration for continuous testing

##### Additional Recommendations

- A progress indicator component
- Relationship between koans and their test implementations
- Error reporting mechanism

Remember to include a clear indication of the entry points and the flow of execution, as this is crucial for understanding how the system guides users through the learning process.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        EP1[contemplate_koans.py]
        EP2[scent.py]
    end

    subgraph TR["Test Runner Layer"]
        MT[Mountain]
        SN[Sensei]
        PTE["Path to Enlightenment"]
        HP[Helper]
        TR1["Test Result Handler"]
    end

    subgraph KL["Koans Layer"]
        KM["Koans Modules"]
        PKG["Package Examples"]
        SM["Supporting Modules"]
    end

    subgraph SL["Support Libraries Layer"]
        CO["Colorama Output"]
        MT1["Mock Testing"]
    end

    subgraph TST["Test Runner Tests"]
        MTT["Mountain Tests"]
        SNT["Sensei Tests"]
        PTT["Path Tests"]
    end

    %% Relationships
    EP1 --> MT
    EP2 --> MT
    MT --> SN
    SN --> PTE
    PTE --> KM
    HP --> MT
    HP --> SN
    TR1 --> SN
    KM --> SM
    KM --> PKG
    SN --> CO
    MT --> MT1
    
    %% Click Events
    click EP1 "https://github.com/himsheda/python_koans/blob/master/contemplate_koans.py"
    click EP2 "https://github.com/himsheda/python_koans/blob/master/scent.py"
    click MT "https://github.com/himsheda/python_koans/blob/master/runner/mountain.py"
    click SN "https://github.com/himsheda/python_koans/blob/master/runner/sensei.py"
    click PTE "https://github.com/himsheda/python_koans/blob/master/runner/path_to_enlightenment.py"
    click HP "https://github.com/himsheda/python_koans/blob/master/runner/helper.py"
    click TR1 "https://github.com/himsheda/python_koans/blob/master/runner/mockable_test_result.py"
    click KM "https://github.com/himsheda/python_koans/tree/master/koans/"
    click PKG "https://github.com/himsheda/python_koans/tree/master/koans/a_package_folder/"
    click SM "https://github.com/himsheda/python_koans/blob/master/koans/triangle.py"
    click CO "https://github.com/himsheda/python_koans/tree/master/libs/colorama/"
    click MT1 "https://github.com/himsheda/python_koans/blob/master/libs/mock.py"
    click MTT "https://github.com/himsheda/python_koans/blob/master/runner/runner_tests/test_mountain.py"
    click SNT "https://github.com/himsheda/python_koans/blob/master/runner/runner_tests/test_sensei.py"
    click PTT "https://github.com/himsheda/python_koans/blob/master/runner/runner_tests/test_path_to_enlightenment.py"

    %% Styling
    classDef ui fill:#3498db
    classDef runner fill:#2ecc71
    classDef koans fill:#f1c40f
    classDef support fill:#95a5a6
    classDef tests fill:#e74c3c

    class EP1,EP2 ui
    class MT,SN,PTE,HP,TR1 runner
    class KM,PKG,SM koans
    class CO,MT1 support
    class MTT,SNT,PTT tests
```
