Change to attrs library for dataclasses
The Attrs package for Python (https://www.attrs.org/en/stable/) is the inspiration behind the Dataclasses package in the Python standard library, and more or less is a superset of the dataclasses functionalities. It could be worth switching over to Attrs for handling the dataclasses in IW2D/interface.py
for these reasons:
- Python version agnostic Since Dataclasses are part of the standard library, which features one has depends on the python verison used. This means that one is locked out of using newer features if one also wishes to allow the code to run on old interpreters.
-
More features - Attrs is generally seen as having a richer and more customizable feature set than Dataclasses. Switching could help remove the need for hacky solutions for e.g. setting a value of a frozen
dataclass
in the__post_init__
method. -
Better defaults - Attrs have some arguably better defaults than dataclasses, such as
slots=True
for attrs vs.slots=False
in dataclasses (3.10+)
I haven't looked much into the specifics, but I would guess that this can be implemented only as changes in the interface.py
file, while leaving the interface unchanged.