--- id: dataclass-factory version: "2.16" license: Apache2 license_treatment: permissive maintenance: active --- # dataclass-factory — An utility class for creating instances of dataclasses License: permissive · Maintenance: active · Downloads: 90.6K/mo ## What it is and what it does dataclass_factory is a utility for bidirectional conversion between dataclass instances and dictionaries or other common types. It handles the boilerplate of parsing nested structures, enums, unions, and optional fields without requiring schema definitions. The factory pattern lets you load a dict into a typed dataclass instance with a single call, and dump instances back to dicts just as easily. It's designed for scenarios where you need to deserialize external data (from APIs, configuration files, or databases) into strongly-typed Python objects, or serialize those objects back to plain data structures. The package supports cyclic references, generic dataclasses, and custom validators, making it suitable for complex domain models and data pipelines. Use it for: - Parse API responses into dataclass instances with automatic type validation and nested object handling. - Load configuration files (JSON, YAML) into typed dataclass structures for application settings. - Serialize dataclass instances back to dictionaries for database storage or API responses. - Validate and transform user input by loading it into a dataclass with custom validators. - Handle linked-list or tree structures where objects reference other instances of the same type. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts dataclasses to and from dictionaries and other common types with minimal configuration, supporting nested structures, enums, unions, and custom validation. Yes. Low install friction, active maintenance, no security issues, and permissive licensing make it a safe choice. Use it when you need to convert between dataclasses and dictionaries without schema boilerplate—particularly for API clients, config loaders, or data pipelines where type safety matters. ## Install pip install dataclass-factory uv add dataclass-factory poetry add dataclass-factory ## Installing dataclass-factory Before you install: Low friction: pure Python wheel with only the standard library dataclasses module as a runtime dependency. Actively maintained with recent commits and no known vulnerabilities. License in practice: Apache 2.0 permissive license allows commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include a copy of the license. Quickstart: pip install dataclass_factory from dataclasses import dataclass import dataclass_factory @dataclass class Book: title: str price: int factory = dataclass_factory.Factory() book = factory.load({"title": "Example", "price": 100}, Book) data = factory.dump(book) Verify before relying: - Whether the claimed 10x speed advantage over marshmallow and dataclasses.asdict holds in your specific use case. - Whether automatic name style conversion (snake_case to CamelCase) is enabled by default or requires explicit configuration. ## Package facts - License: Apache2 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 90.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dataclass serialization deserialization, convert dataclass to dict, dataclass json loading, dataclass factory pattern, parse dict into dataclass, dataclass validation conversion, typed data loading, serialization, dataclass-utilities, type-conversion [View on SkillFed](https://skillfed.io/packages/dataclass-factory) · [View on PyPI](https://pypi.org/project/dataclass-factory/)