-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move dataclass to dedicated module #3195
base: main
Are you sure you want to change the base?
Conversation
f37824b
to
ad6d1bc
Compare
What do you think about putting these into a package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My word should have very little weight here, but fwiw I like it. To me it makes things a bit more 'digestable'.
I wonder if we shouldn't come up with a master plan for what do we want in what file, subpackage, etc, so there is a clear logic and goal to stive for.
As for attrs, can't comment at the moment, but am educating myself about attrs vs dataclasses usage.
+1 to
Which implementations? If you mean |
ad6d1bc
to
ef2e4fc
Compare
Cool, I've moved the stuff around, I think after this the only things left to move would be I think it would also be good to start using Next step for this would be to detangle the some of these dataclasses and revert some of the redirects. In some cases it is obvious like |
+1 |
Exceptions were on my list for sure, something like
It already is, isn't it?
Hmm, none of the options looks tempting, sorry. Why do you want to rename them? That might help us spend a couple of productive weeks, selecting the right name :) |
I was thinking stub files as additive to keep things cleaner from parts like
The idea here is that we can do a few more optimizations if we know that the
But another main reason is for plugin developers to guarantee that any improvements made on the base tmt containers do not require any refactoring on their side. |
Hm, I could live with the current approach, something like
WDYT about code being the source here? My idea was to make plugin code the single source of truth, and generate plugin documentation, schema, and everything from the code of the plugin. The same would apply to spec like test/plan/story fields.
Yep, that's one of the goals :)
I think we are aligned, at least in general, and what remains are the technicalities. For example, this move of "base container classes" into other own location, absolutely. What I'm less sure is whether we speak the same language when it comes to names, e.g.
If you mean the original
|
I am thinking of something slightly different. For
which would deprecate to point the developer to
👍 to that. Would work similar with the json schema generation.
Here is some reference form
Indeed we are in sync on this thought 👍.
Hmm, makes sense. One alternative is
This can be relaxed. It's mostly from navigating the
You mean w.r.t. review or with functionality? And I guess this is for the
👍 I can work with that. Let's finish the design discussion in this PR, and then I'll open a few separate PRs by cherry-picking form here. |
I'm not sure we speak about the same kind of deprecation. I meant one when a "metadata key" or CLI option gets deprecated from users' PoV. Like @option(
'--format', default=_test_export_default,
show_default=True,
help='Output format.',
deprecated=Deprecated('1.21', hint='use --how instead'),
choices=_test_export_formats) I'm starting tot think you meant deprecating use of
Yep, I played a bit with Jinja and plugins while creating plugin docs, I got some general feeling, and this should be definitely doable. I would very much like to add some library that would let us reliably process annotations, manually it's a PITA to distinguish between
I suppose
Both review and functionality. Smaller steps are easier to review, as long as there's some documented transition path that's being followed. There are definitely out-of-tree plugins we need to care about, luckily we do run several tests on every tmt PR checking these as well, so we should get notified as soon as we break something. And often it may end up with fix of those plugins, again, if it's understood why and for how long a apparently weird change is needed, it's easier to sell and handle.
|
Adding this one to 1.38, let's see whether it can be done as a whole. |
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Attempt2. This time I've separated the usage into
|
I'll definitely check it out before I'm done today. It looks like a good candidate for 1.38.
I think mypy even has some special handling for
Could be, although I for one would be happy by the move alone, more granularity might make things harder to follow again. It's an extreme example now, I'd like to avoid swinging to the opposite side of granularity scale :) But let's see.
Nothing serious, it's a class that's used only in that method, so I made it a nested one. It can be there, it doesn't have to be there, it's up to us. It's probably the only one in tmt codebase, I suppose it could be argued that it should move out of the method. |
A few reasons for this move:
attrs
more easy Useattrs
#2831help
to the attribute's docstingA few things to point out:
dataclass
andfield
usage are now unified and populate themetadata
. 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 betweenDataContainer
type of dataclasses and plaindataclass
like the ones inhardware.py
?dataclasses
and thefrom 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 nametmt.dataclasses.dataclass
vs short namefield
Pull Request Checklist