Skip to content
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

Add default yaml dumping method #57

Open
bruno-f-cruz opened this issue Aug 29, 2024 · 1 comment
Open

Add default yaml dumping method #57

bruno-f-cruz opened this issue Aug 29, 2024 · 1 comment

Comments

@bruno-f-cruz
Copy link
Collaborator

We should add a utility method to dump yamls to file so users don't have to worry about figuring out the encoding settings. This should be solved at the same time as #7

@bruno-f-cruz
Copy link
Collaborator Author

 As an example:
   with open(path, "w", encoding="utf-8") as f:
            f.write(_yaml_dump(manifest_config))
        return path

    def _yaml_dump(model: BaseModel) -> str:
        native_json = json.loads(model.model_dump_json())
        return yaml.dump(native_json, default_flow_style=False)

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

No branches or pull requests

1 participant