tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Move dataclass to dedicated module

Open LecrisUT opened this issue 5 months ago • 10 comments

A few reasons for this move:

  • It would make migrating to attrs more easy #2831
  • Plugin developers should use the same dataclass type
  • This would allow some neat customization, e.g. if we add https://github.com/rr-/docstring_parser, we can move the help to the attribute's docsting

A few things to point out:

  • All dataclass and field usage are now unified and populate the metadata. In principle this should be fine since it would just populate a field that would never be used, but should we do something else there to distinguish between DataContainer type of dataclasses and plain dataclass like the ones in hardware.py?
  • The import syntax is a bit disjoint. The naming of dataclasses and the from import is done like this in order to minimize the diffs for the purpose of initial review, but I think we should change it to be more uniform w.r.t. full name tmt.dataclasses.dataclass vs short name field

Pull Request Checklist

  • [x] implement the feature
  • [ ] write the documentation

LecrisUT avatar Sep 05 '24 16:09 LecrisUT