dataclass-csv
Map CSV data into dataclasses
Decision gist · record as of 2026-08-14
Yes. Zero runtime dependencies, active maintenance, permissive license, and no known vulnerabilities make it a low-risk choice. Install it if you work with CSV files and want type safety and cleaner code than dict-based approaches; skip it only if you need advanced CSV features (e.g., streaming very large files, complex nested structures) beyond the library's scope.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with a recent release (194 days ago) and steady repository activity.
License · maintenance · safety
permissive license (permissive) — Permissive license (BSD) allows use in commercial and proprietary projects with minimal restrictions.
last release 2026-02-01 (194 days) · last repo commit 2026-06-22 · 196 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 133,250 downloads/mo, #11,524 on PyPI
Alternatives
Verify before relying
from dataclasses import dataclass
from dataclass_csv import DataclassReader
@dataclass
class User:
firstname: str
email: str
age: int
with open('users.csv') as f:
reader = DataclassReader(f, User)
for row in reader:
print(row)- Whether custom type constructors beyond the documented set (str, int, float, complex, datetime, bool) are reliably supported
- Performance characteristics when processing large CSV files (row count or file size limits)
What it is and what it does
Dataclass CSV bridges Python's dataclasses and CSV file handling by reading CSV rows directly into typed dataclass instances instead of dictionaries. It performs automatic type conversion and validation based on dataclass field annotations, catching type mismatches and reporting the exact CSV line where errors occur. The library also provides a writer to serialize dataclass instances back to CSV.
The package is designed to reduce boilerplate: instead of manually looping through CSV rows, converting strings to the correct types, validating data, and applying defaults, you define a dataclass with type hints and let DataclassReader handle the rest. It supports field mapping for mismatched column names, default values, and datetime formatting via decorators.
Use it for
- Load CSV data into typed objects for data processing pipelines where type safety and early error detection matter
- Validate CSV imports before storing in a database, with line-number feedback for fixing malformed rows
- Export application data to CSV by passing a list of dataclass instances to DataclassWriter
- Map CSV columns with non-standard names to dataclass fields without manual column indexing
- Parse datetime or numeric fields from CSV with automatic conversion and format control
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Zero runtime dependencies, active maintenance, permissive license, and no known vulnerabilities make it a low-risk choice. Install it if you work with CSV files and want type safety and cleaner code than dict-based approaches; skip it only if you need advanced CSV features (e.g., streaming very large files, complex nested structures) beyond the library's scope.
Install
dataclass-csv on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with a recent release (194 days ago) and steady repository activity.
License in practice
Permissive license (BSD) allows use in commercial and proprietary projects with minimal restrictions.
Quickstart
from dataclasses import dataclass
from dataclass_csv import DataclassReader
@dataclass
class User:
firstname: str
email: str
age: int
with open('users.csv') as f:
reader = DataclassReader(f, User)
for row in reader:
print(row)
Verify before relying
- Whether custom type constructors beyond the documented set (str, int, float, complex, datetime, bool) are reliably supported
- Performance characteristics when processing large CSV files (row count or file size limits)
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 194 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 133,250 / month, #11,524 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: dataclass_csv-1.4.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “csv to dataclass mapping”
- dataclass-csvReads and writes CSV files using Python dataclasses, with automatic…
- databind.coreDeserializes and serializes Python dataclasses and native types to…
- dataclass-wizardDataclass Wizard converts Python dataclasses to and from JSON, YAML,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also typed-json-dataclass · dataclasses · dataclass-wizard · dataclasses-json · dacite · dataclass-factory · clevercsv · djangorestframework-dataclasses · recordclass · aiocsv