# recenama/practice-pull-request architecture

> Architecture diagram of the GitHub repository recenama/practice-pull-request, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/recenama/practice-pull-request
- Repository: https://github.com/recenama/practice-pull-request

## Overview

##### Project type and purpose
- This is a small, CLI-based Python utility whose primary function is to read a text file of words, optionally remove duplicates, and print or return the results.
- It also serves as a teaching/demo repository for DevOps concepts (Makefile usage, Docker execution, Git workflows).

##### Key components
a. **User / Developer**
- Invokes `make run` or directly runs `python3 main.py`.
b. **Host Environment**
- Linux/macOS (required by Makefile); optionally Windows via VM.
- Docker Engine running on the host.
c. **Makefile**
- Provides targets like `run` to encapsulate build/run commands.
d. **Docker Container (optional)**
- Defines a lightweight, reproducible execution environment for Python 3.
e. **Python Interpreter + main.py**
- Contains the core logic: reads `<filename>`, checks the `dup` flag, filters duplicates, outputs the word list.
f. **Input File (`palabras.txt` or any `<filename>`)**
- Plain‐text resource, one word per line.
g. **Output / Console**
- STDOUT displaying processed word list.

##### Relationships & data flow
- The **User** issues a command (`make run` or `python3 main.py`).
- If using `make run`:
- The **Makefile** calls Docker CLI to spin up the container.
- Docker Engine on the **Host** provisions the **Container**.
- Inside the **Container**, Python 3 runs `main.py`, mounts the input file from the host.
- If running directly: Python interpreter on the **Host** executes `main.py` against the file.
- `main.py` reads the **Input File**, applies duplicate-removal logic, then writes to **STDOUT**.

##### Architectural patterns & design principles
- **Separation of concerns**:
- Makefile isolates build/run mechanics.
- Docker container isolates runtime environment.
- `main.py` isolates business logic (file I/O + duplication logic).
- **Infrastructure as Code**: the Makefile codifies commands for reproducibility.
- **Containerization**: Docker encapsulates dependencies and ensures cross-platform consistency.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User / Developer"]:::user

    %% Host Environment
    subgraph "Host Environment"
        Makefile["Makefile"]:::blue
        DockerEngine["Docker Engine"]:::env
        HostPython["Python Interpreter"]:::orange
    end

    %% Docker Container
    subgraph "Docker Container"
        Container["Container"]:::orange
        PyRuntime["Python 3 Runtime"]:::orange
        Script["main.py"]:::orange
    end

    %% Resources
    InputFile["palabras.txt"]:::resource
    Output["STDOUT (Console)"]:::resource
    Doc["README.md"]:::resource

    %% Flows
    User -->|"runs `make run`"| Makefile
    Makefile -->|"docker run"| DockerEngine
    DockerEngine -->|"provisions"| Container
    Container -->|"contains"| PyRuntime
    PyRuntime -->|"executes"| Script
    Script -->|"reads file"| InputFile
    Script -->|"filters duplicates"| Script
    Script -->|"writes output"| Output

    User -->|"or runs `python3 main.py`"| HostPython
    HostPython -->|"executes"| Script

    User -->|"views docs"| Doc

    %% Click events
    click Makefile "https://github.com/recenama/practice-pull-request/tree/main/./Makefile"
    click Script "https://github.com/recenama/practice-pull-request/blob/main/./main.py"
    click InputFile "https://github.com/recenama/practice-pull-request/blob/main/./palabras.txt"
    click Doc "https://github.com/recenama/practice-pull-request/blob/main/./README.md"

    %% Styles
    classDef user fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef blue fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef env fill:#90EE90,stroke:#333,stroke-width:1px
    classDef orange fill:#FFA500,stroke:#333,stroke-width:1px
    classDef resource fill:#D3D3D3,stroke:#333,stroke-width:1px
```
