# aristocratos/bpytop architecture

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

- Interactive diagram: https://gitdiagram.com/aristocratos/bpytop
- Repository: https://github.com/aristocratos/bpytop

## Overview

##### Main Components Identification
The system should be represented as a modular monitoring application with these key components:

a. Core Monitor Engine
- Process monitoring
- CPU statistics
- Memory statistics
- Network monitoring
- Disk I/O monitoring

b. UI Rendering System
- Terminal interface
- Theme management
- Graph rendering
- Mouse/Keyboard input handling

c. Configuration System
- Config file management
- Theme loading
- User preferences

**[System Input Layer]**

- Hardware/OS Data Sources
- psutil (Core dependency)
- coretemp/osx-cpu-temp (Optional)
- System metrics

**[Core Processing Layer]**

- Data Collectors
- CPU Monitor
- Memory Monitor
- Process Monitor
- Network Monitor
- Disk Monitor

**[Presentation Layer]**

- UI Components
- Graph Renderer
- Process List
- System Stats
- Menu System

**[Configuration Layer]**

- Config Management
- User Config (~/.config/bpytop)
- Theme System
- Runtime Options

##### Implementation Details

- Use rounded rectangles for processes
- Version information and Python requirement

##### Key Relationships to Highlight

- psutil integration for system metrics
- Theme system's interaction with UI
- Configuration file's influence on all components
- Real-time data flow from system to UI

##### Additional Notes

- Error logging system
- Update checker component
- Mouse/keyboard input handlers
- Theme loading paths

Remember to maintain a balance between detail and clarity, focusing on the core functionality while still showing important implementation details that make bpytop unique, such as its theme system and cross-platform support.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        SYS[System Metrics]
        PS[psutil Library]
        TEMP["/coretemp/osx-cpu-temp"]
        PS --> SYS
        TEMP -.-> SYS
    end

    subgraph Core
        MON[Core Monitor Engine]:::core
        CPU[CPU Monitor]
        MEM[Memory Monitor]
        PROC[Process Monitor]
        NET[Network Monitor]
        DISK[Disk Monitor]
        
        SYS --> MON
        MON --> CPU
        MON --> MEM
        MON --> PROC
        MON --> NET
        MON --> DISK
    end

    subgraph UI
        RENDER[Graph Renderer]
        PLIST[Process List]
        STATS[System Stats]
        MENU[Menu System]
        
        CPU --> RENDER
        MEM --> RENDER
        PROC --> PLIST
        NET --> STATS
        DISK --> STATS
    end

    subgraph Config
        CONF[Configuration Management]:::config
        THEME[Theme System]:::theme
        USER[User Config]
        RUN[Runtime Options]
        
        CONF --> USER
        CONF --> THEME
        CONF --> RUN
        THEME --> RENDER
        THEME --> PLIST
        THEME --> STATS
        THEME --> MENU
    end

    classDef core fill:#a8e6cf
    classDef config fill:#ffd3b6
    classDef theme fill:#ffaaa5
    classDef input fill:#dcedc1

    click MON "https://github.com/aristocratos/bpytop/blob/master/bpytop.py"
    click THEME "https://github.com/aristocratos/bpytop/tree/master//themes"
    click CONF "https://github.com/aristocratos/bpytop/blob/master/pyproject.toml"
    click USER "https://github.com/aristocratos/bpytop/tree/master/.config/bpytop"

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Config Components]:::config
        L3[Theme Components]:::theme
        L4[Input Components]:::input
    end
```
