# rcmdnk/s3-reader architecture

> Architecture diagram of the GitHub repository rcmdnk/s3-reader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rcmdnk/s3-reader
- Repository: https://github.com/rcmdnk/s3-reader

## Overview

s3-reader is a small Python library that presents local paths, S3 objects, and HTTP(S) resources through a File object. A caller constructs File; it normalizes and routes the path, downloads remote content to a temporary file, and exposes that path for ordinary local reading. S3 access uses boto3-session and AWS credentials/retry options; HTTP uses urllib. Destruction cleans up temporary storage. The graph follows the sampled implementation and README; version metadata is included because it is a core module, though it is separate from file reading.

Main entry points: [`src/s3_reader/file.py`](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py) (File manager), [`src/s3_reader/__init__.py`](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/__init__.py) (Package export), [`src/s3_reader/version.py`](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/version.py) (Version metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Calling code"))
node_file["File manager<br/>[file.py]"]
node_s3_download["S3 download<br/>[file.py]"]
node_http_download["HTTP download<br/>[file.py]"]
node_boto_session["boto3-session"]
node_s3_service["Amazon S3"]
node_http_origin["HTTP origin"]
node_temp_storage["Temporary storage"]
node_local_path["Local path"]
node_version["Version metadata<br/>[version.py]"]
node_package_export["Package export<br/>[__init__.py]"]

node_caller -->|"constructs"| node_file
node_file -->|"routes S3"| node_s3_download
node_file -->|"routes HTTP"| node_http_download
node_s3_download -->|"creates session"| node_boto_session
node_s3_download -->|"downloads object"| node_s3_service
node_http_download -->|"fetches URL"| node_http_origin
node_s3_download -->|"writes download"| node_temp_storage
node_http_download -->|"writes response"| node_temp_storage
node_file -->|"cleans up"| node_temp_storage
node_file -->|"exposes path"| node_caller
node_caller -->|"reads file"| node_local_path
node_package_export -->|"exports"| node_file
node_package_export -->|"loads version"| node_version

click node_file "https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py"
click node_s3_download "https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py"
click node_http_download "https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py"
click node_version "https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/version.py"
click node_package_export "https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_boto_session,node_s3_service,node_http_origin,node_local_path toneIndigo
class node_file,node_s3_download,node_http_download,node_version,node_package_export toneTeal
class node_temp_storage toneAmber
```

## Components

### Other components

- **Calling code**
- [File manager](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py): `src/s3_reader/file.py`
- [S3 download](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py): `src/s3_reader/file.py`
- [HTTP download](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/file.py): `src/s3_reader/file.py`
- **boto3-session**
- **Amazon S3**
- **HTTP origin**
- **Temporary storage**
- **Local path**
- [Version metadata](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/version.py): `src/s3_reader/version.py`
- [Package export](https://github.com/rcmdnk/s3-reader/blob/main/src/s3_reader/__init__.py): `src/s3_reader/__init__.py`

## Connections

- Calling code → File manager: constructs (evidence: `README.md`)
- File manager → S3 download: routes S3 (evidence: `src/s3_reader/file.py`)
- File manager → HTTP download: routes HTTP (evidence: `src/s3_reader/file.py`)
- S3 download → boto3-session: creates session (evidence: `src/s3_reader/file.py`)
- S3 download → Amazon S3: downloads object (evidence: `src/s3_reader/file.py`)
- HTTP download → HTTP origin: fetches URL (evidence: `src/s3_reader/file.py`)
- S3 download → Temporary storage: writes download (evidence: `src/s3_reader/file.py`)
- HTTP download → Temporary storage: writes response (evidence: `src/s3_reader/file.py`)
- File manager → Temporary storage: cleans up (evidence: `src/s3_reader/file.py`)
- File manager → Calling code: exposes path (evidence: `README.md`)
- Calling code → Local path: reads file (evidence: `README.md`)
- Package export → File manager: exports (evidence: `src/s3_reader/__init__.py`)
- Package export → Version metadata: loads version (evidence: `src/s3_reader/__init__.py`)
