Metadata-Version: 2.4
Name: csv-member-reader
Version: 0.1.0
Summary: A Python library for reading member records from CSV files
Author-email: Raghu Murthy <raghu.k.murthy@gmail.com>
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: csv,members,reader
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# csv-member-reader

A Python library for reading member records from CSV files. Supports both iteration (memory-efficient for large files) and loading all records at once.

## Installation

```bash
pip install csv-member-reader
```

## Requirements

- Python 3.9+
- No external dependencies

## Quick Start

### As a library

```python
from csv_member_reader import CSVMemberReader

# Iterate over members (memory-efficient)
for member in CSVMemberReader("members.csv"):
    print(member.full_name)

# Load all members into a list
members = CSVMemberReader("members.csv").read()
print(members[0].first_name)  # "John"
print(members[0].full_name)   # "John Smith"
```

### As a CLI tool

```bash
csv-member-reader path/to/members.csv
```

## CSV Format

The CSV file must include these columns (order does not matter):

| Column | Description |
|---|---|
| `id` | Unique identifier |
| `first_name` | First name |
| `last_name` | Last name |
| `email` | Email address |
| `gender` | Gender |
| `ip_address` | IP address |

## API Reference

### `CSVMemberReader(path)`

| Parameter | Type | Description |
|---|---|---|
| `path` | `str` or `Path` | Path to the CSV file |

**Methods:**

- **`.read()`** → `list[Member]` — loads all records into memory
- **`__iter__`** — yields `Member` objects one at a time

**Raises:** `FileNotFoundError` if the file does not exist.

---

### `Member`

A dataclass with the following fields:

| Field | Type |
|---|---|
| `id` | `str` |
| `first_name` | `str` |
| `last_name` | `str` |
| `email` | `str` |
| `gender` | `str` |
| `ip_address` | `str` |

**Property:**

- **`.full_name`** → `str` — returns `"{first_name} {last_name}"`

## License

MIT
