Repository navigation
[api] refactor api preview -> save_preview - #15
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The OutputActions constructor change makes save_preview required and reorders fields, introducing an avoidable API break and forcing brittle positional-arg updates in tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Refactors the prep API by renaming OutputActions.preview to OutputActions.save_preview, aligning the CLI option name with the underlying API and updating affected tests.
Changes:
- Renamed
OutputActions.preview→OutputActions.save_previewand updateddo_dumplogic accordingly. - Updated
prepCLI wiring to passsave_preview. - Adjusted API tests to match the new
OutputActionsconstructor shape.
File summaries
| File | Description |
|---|---|
src/prep/api/dataio.py |
Renames the preview field to save_preview and updates do_dump to use it. |
src/prep/cli.py |
Passes save_preview into OutputActions from the CLI option. |
tests/api/test_dataio.py |
Updates OutputActions construction in tests for the renamed field. |
Review details
Suppressed comments (1)
tests/api/test_dataio.py:132
- This test also relies on
OutputActionspositional argument order (and had to add an extraNoneforsave_preview). Switching to keyword arguments will make the test resilient to future refactors of the dataclass field order.
action = OutputActions(
tmp_path, None, False, None, None, "org/repo", None, False
)
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
229
to
233
| save: bool | None | ||
| save_parquet: bool | ||
| save_preview: int | None | ||
|
|
||
| hf: bool | None |
Comment on lines
+91
to
+93
| action = OutputActions( | ||
| tmp_path, True, False, None, True, "org/repo", None, True | ||
| ) |
| the behavior of ``OutputActions.do_save``. | ||
| """ | ||
| if self.preview is None or self.preview <= 0: | ||
| if self.save_preview is None or self.save_preview <= 0: |
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.
Before submitting
Changes
previewtosave_previewin api.