Merged
Conversation
- Remove input validation from DataMapping - Input schemas now metadata-only, not enforced - Add Generic type support to DataMapping - Better type safety for output models - Replace input_schema with min/other_input_schemas - Documents expected source models as metadata - Update has_schemas to only check output_schema - Remove input validation helpers and functions
- Remove DataMapping class entirely - Consolidate functionality into Mapper - Merge transformation logic into Mapper - Remove DataMapping from __all__ exports - Simplify Mapper constructor interface - Direct transformations parameter - Update tests to use new Mapper API - Bump version to 0.1.5
- Add .pithy/ to .gitignore - Add .claude* pattern to .gitignore - Excludes Claude-related files from tracking
- Simplifies API with method chaining syntax
- p.get('path').join(' ').upper() vs pipe operators
- Adds multi-path extraction to get() function
- get(['path1', 'path2']) returns combined values
- Enhances join() with flatten parameter
- Flattens nested lists and filters None values
- Updates README with cleaner example code
- Removes DataMapping wrapper requirement
- Changes Mapper to accept Mapping interface
- Rewrites README for better clarity and brevity - Removes verbose explanations and comments - Streamlines code examples - Reorganizes feature table with clearer descriptions - Simplifies Table/DataFrame section with examples - Condenses motivation section into design philosophy - Focuses on practical benefits over theory
There was a problem hiding this comment.
2 issues found across 13 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="chidian/mapper.py">
<violation number="1" location="chidian/mapper.py:152">
Short-circuiting flexible mode without an output schema bypasses _execute_flexible, so transform exceptions now raise instead of being captured as ValidationIssues. Please route this case through _execute_flexible to preserve flexible-mode error handling.</violation>
</file>
<file name="chidian/partials.py">
<violation number="1" location="chidian/partials.py:68">
Passing arguments to chainable methods like `strip(' ,')` throws a TypeError because `attr(*args, **kwargs)` calls descriptors without the value. Wrap the call so the value becomes the first argument.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| if self._backward_compat and not self.data_mapping.has_schemas: | ||
| return self.data_mapping.transform(data) | ||
| # For non-schema mode, just return dict | ||
| if not self.has_schemas and self.mode == ValidationMode.FLEXIBLE: |
There was a problem hiding this comment.
Short-circuiting flexible mode without an output schema bypasses _execute_flexible, so transform exceptions now raise instead of being captured as ValidationIssues. Please route this case through _execute_flexible to preserve flexible-mode error handling.
Prompt for AI agents
Address the following comment on chidian/mapper.py at line 152:
<comment>Short-circuiting flexible mode without an output schema bypasses _execute_flexible, so transform exceptions now raise instead of being captured as ValidationIssues. Please route this case through _execute_flexible to preserve flexible-mode error handling.</comment>
<file context>
@@ -107,9 +148,9 @@ def __call__(self, data: Any) -> Any | MapperResult:
- if self._backward_compat and not self.data_mapping.has_schemas:
- return self.data_mapping.transform(data)
+ # For non-schema mode, just return dict
+ if not self.has_schemas and self.mode == ValidationMode.FLEXIBLE:
+ return self.transform(data)
</file context>
| new_op = ( | ||
| attr | ||
| if not args and not kwargs | ||
| else (lambda v: attr(*args, **kwargs)(v)) |
There was a problem hiding this comment.
Passing arguments to chainable methods like strip(' ,') throws a TypeError because attr(*args, **kwargs) calls descriptors without the value. Wrap the call so the value becomes the first argument.
Prompt for AI agents
Address the following comment on chidian/partials.py at line 68:
<comment>Passing arguments to chainable methods like `strip(' ,')` throws a TypeError because `attr(*args, **kwargs)` calls descriptors without the value. Wrap the call so the value becomes the first argument.</comment>
<file context>
@@ -44,9 +44,52 @@ def __len__(self) -> int:
+ new_op = (
+ attr
+ if not args and not kwargs
+ else (lambda v: attr(*args, **kwargs)(v))
+ )
+ return FunctionChain(*self.operations, new_op)
</file context>
Suggested change
| else (lambda v: attr(*args, **kwargs)(v)) | |
| else (lambda v: attr.func(v, *args, **kwargs)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes N/A
Background
Design (high-level)
|syntaxOther notes
Summary by cubic
Streamlines the data mapping API by removing DataMapping, consolidating functionality into Mapper, and adding ergonomic method chaining and multi-path extraction in partials. This reduces boilerplate and makes transformations easier to read.
New Features
Migration