Skip to content

[api] refactor api preview -> save_preview - #15

Merged
Moenupa merged 4 commits into
mainfrom
refactor/api-save-preview
Aug 31, 2026
Merged

Moenupa merged 4 commits into
mainfrom
refactor/api-save-preview

Conversation

@Moenupa

@Moenupa Moenupa commented Aug 31, 2026 •

Copy link
Copy Markdown
Owner

Before submitting

Changes

  • rename preview to save_preview in api.
  • I updated the tests.
  • I updated documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_preview and updated do_dump logic accordingly.
  • Updated prep CLI wiring to pass save_preview.
  • Adjusted API tests to match the new OutputActions constructor 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 OutputActions positional argument order (and had to add an extra None for save_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 thread src/prep/api/dataio.py
Comment on lines 229 to 233
save: bool | None
save_parquet: bool
save_preview: int | None

hf: bool | None
Comment thread tests/api/test_dataio.py
Comment on lines +91 to +93
action = OutputActions(
tmp_path, True, False, None, True, "org/repo", None, True
)
Comment thread src/prep/api/dataio.py
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:
@Moenupa
Moenupa merged commit 48dfe89 into main Aug 31, 2026
4 checks passed
@Moenupa
Moenupa deleted the refactor/api-save-preview branch August 31, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants