Skip to content

[WIP] Recipe model_dump fixes #1379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

[WIP] Recipe model_dump fixes #1379

wants to merge 9 commits into from

Conversation

rahul-tuli
Copy link
Collaborator

@rahul-tuli rahul-tuli commented Apr 23, 2025

This PR builds on top of #1328 and reintroduces those changes which were reverted in #1378 due to failing base tests. It addresses issue #1319 by refactoring the Recipe class, particularly improving its serialization capabilities to ensure proper round-trip consistency.

Key Changes

Recipe Class Structure Improvements

  • Reorganized class field declarations to the top of the class for better code organization and readability
  • Fixed field type annotations, making version and metadata properly Optional
  • Replaced the deprecated dict() method with the Pydantic v2 compatible model_dump() method
  • Completely rewrote the serialization logic to produce cleaner, more consistent YAML output

Serialization Enhancements

  • Implemented a new model_dump() method that properly formats recipe data for serialization
  • Removed the redundant _get_yaml_dict() helper method by integrating its functionality into model_dump()
  • Fixed argument handling during recipe creation to prevent nesting issues
  • Improved stage grouping and naming conventions for better serialization consistency

Test Improvements

  • Restructured tests into organized test classes with clear purposes
  • Added testing for serialization and deserialization workflows
  • Introduced new test cases for file-based serialization
  • Created helper methods for comparing recipe modifiers to improve test readability
  • Added a new valid recipe test case to validate the enhanced serialization format

Signed-off-by: Rahul Tuli <[email protected]>
Base automatically changed from revert-998be99a to main April 24, 2025 02:25
Signed-off-by: Rahul Tuli <[email protected]>
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