Skip to content

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

@jesper-friis

Description

@jesper-friis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions