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

Improve consistency of options for json, yaml and dict representations #886

Open
jesper-friis opened this issue Jul 6, 2024 · 0 comments

Comments

@jesper-friis
Copy link
Collaborator

Overview

  • Make options in the yaml plugin consistent with the json plugin
  • Make options for asdict() and asjson() consistent with the options for to_bytes() and from_bytes() for the json plugin.

Replace the Python implementation of dlite.Instance.asdict() and dlite.utils.instance_from_dict() by combining json.loads() with dlite.Instance.to_bytes("json", options=options) and json.dumps() with dlite.Instance.from_bytes("json", id=id, options=options), respectively.

Make the yaml plugin more consistent with the json plugin:

  • with_uuid could be renamed to with-uuid for consistency with the json plugin
  • it would be more useful to use the single option for controlling for output (this is how it is used in the json plugin)

Avoid as long as possible to break backward compatibility. Old option names should be kept with a deprecation warning.

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