cobbler / libcobblersignatures

Library for working with cobbler signatures
GNU General Public License v2.0
4 stars 5 forks source link

Conversion to a dataclass of the Osversion class #38

Open SchoolGuy opened 3 years ago

SchoolGuy commented 3 years ago

So after reasoning with @agraul in this thread here, we have decided to get rid of properties and use a dataclass for Osversion.

Since we do want to do type validation on the members, we need a library who supports that. I see three options currently:

I would vote for the gata library because it seems the most used one but I see the downside that this means that we can't run it with Python 3.6 which we have on SLE15 (no SP).

CC @nodeg @meaksh @agraul @vzhestkov we need to maintain this library in the future so the choice is also up to you. I did not look up what we have in the Buildservice packaged or not already.

vzhestkov commented 3 years ago

+1 for gata

agraul commented 3 years ago

@SchoolGuy something is wrong in the description, in * enforce-typing you link to gata and vice versa.

dataclass-type-validator's author said they'd move to gata themself in https://github.com/levii/dataclass-type-validator/issues/5, I wonder how well it's going to be supported.

python-enforce-typing's decorator is pretty nice and it works with Python3.6 and the code is pretty simple, while gata is a lot more complex. The downside is that there are 2 open issues about incomplete type checks.

gata wasn't updated in a while either, but has no real issue open at this moment. The problems I see with gata is that 1. it does not work on SLE 15 and 2. I couldn't quickly find where validate_dataclass is defined. From a maintenance perspective, python-enforce-typing seems more approachable to me.

All in all, I would try python-enforce-typing and see if it is good enough. If it is, great. If not we can see if it makes sense to improve it or if we should use gata instead.