tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Refactor "to YAML" and "from YAML" helpers

Open happz opened this issue 3 months ago • 0 comments

  • naming: use to_yaml and from_yaml first, to be aligned with the rest of codebase (e.g. to_spec).
  • to_yaml and from_yaml are the primary work horses: most of the time, caller does not care about the data types at all.
  • yaml_to_list and yaml_to_dict survive, but may eventually become replaced with some Pydantic magic, as they are not just about dict or list, but also types of keys, values, and items, and our code cannot validate that.
  • YAML loader/dumper creation separated from its use. Eventually we may cache the object, but it's unknown whether the object itself can be used in multiple threads safely.
  • some extra documentation, keyword-only arguments, etc.

Pull Request Checklist

  • [x] implement the feature

happz avatar Nov 18 '25 08:11 happz