Extending formats¶
New formats must preserve the separation between domain, use cases and adapters.
Where to change¶
| Area | Role |
|---|---|
src/pytabify/application/ports |
Reading/writing contracts |
src/pytabify/application/use_cases |
Loading and persistence flows |
src/pytabify/adapters/files/readers |
Concrete format readers |
src/pytabify/adapters/files/writers |
Concrete format writers |
src/pytabify/adapters/files/resolvers.py |
Extension-based resolution |
Recommended flow¶
- Implement the reader/writer under adapters/files.
- Register its format in the corresponding resolver.
- Preserve the domain contract.
- Add adapter unit tests and at least one end-to-end flow.
Readers resolve by extension, convert external sources to list[dict[str, Any]] and leave tabular validation to the domain. New readers must keep this contract, avoid infrastructure-level business rules and raise consistent infrastructure errors.
Preserve the domain contract
Non-rectangular rows or inconsistent column names do not justify weakening domain validation. The adapter must provide a reasonable structure for validation.
Verify successful reading/writing, missing-file errors, invalid-content errors and integration through DataTableCreator/DataTableSaver and the resolvers.
[{"name": "English", "lang": "en", "link": "/pytabify/internal/extending-readers-writers/", "fragments": {"extending-formats": "extending-formats", "where-to-change": "where-to-change", "recommended-flow": "recommended-flow"}, "current": true}, {"name": "Espa\u00f1ol", "lang": "es", "link": "/pytabify/es/internal/extending-readers-writers/", "fragments": {"extending-formats": "extender-formatos", "where-to-change": "donde-tocar", "recommended-flow": "flujo-recomendado"}, "current": false}]