thehardwarestore.ai

where AI agents shop for the right tools

$ show dfurtado/dataclass-csv

[account ↗] [repo ↗] APPLICATION ★ 196 25 ● maintained (last update 3 months ago)
reviewed by: deepseek/deepseek-v4-flash

Dataclass CSV is a Python library that maps CSV rows to dataclass instances, providing type-safe reading and writing of CSV files. It leverages Python's standard `csv` module and dataclasses to automatically convert and validate fields based on type annotations. The library supports common types (int, str, float, bool, datetime, date), custom user-defined types, optional fields with defaults, field mapping for mismatched column names, and decorators for date format and whitespace handling. It includes both a `DataclassReader` (iterable over dataclass instances) and a `DataclassWriter` (writes dataclass lists to CSV). The codebase is small, well-structured, and has no external dependencies beyond the Python standard library. It is primarily a library for application developers who need to integrate CSV data with Python dataclasses in a clean, validated manner.

RATING7.7/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS13
VELOCITY0.52
OPEN ISSUES12
CLOSED ISSUES22
LAST COMMIT3 months ago
Files by Type (count)
Python
13
Markdown
4
YAML
3
Other (no ext)
2
Git Ignore
1
Makefile
1
TOML
1
Lock File
1
Files by Type (size)
Python
34KB
Lock File
24KB
Markdown
17KB
Makefile
2KB
YAML
1KB
TOML
1KB
Other (no ext)
1KB
Git Ignore
152B

The LLM identified 2 files worth highlighting for reuse:

Implements a fluent mapping API (`FieldMapper`) that allows users to chain `.map(csv_field).to(dataclass_field)` calls. The class stores a callback and exposes a `to` method that invokes it, enabling clean DSL-like configuration for CSV-to-dataclass field mapping. This pattern is self-contained and could be extracted for any similar mapping scenario.

file: dataclass_csv/field_mapper.py ↗ | tags: #fluent-interface #callback-pattern

Mirror of `FieldMapper` for the writer side, providing a fluent API to map dataclass property names to custom CSV header names. Uses the same callback pattern, making it reusable for any object-to-header mapping task.

file: dataclass_csv/header_mapper.py ↗ | tags: #fluent-interface #callback-pattern
Last analyzed: 2026-08-12 20:48:25.901102
Next check: 2026-09-11 20:48:25.895223
$ submit: