Skip to content
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

Rework of the subgroups feature + Minor Refactoring #185

Merged
merged 48 commits into from
Jan 10, 2023
Merged

Conversation

lebrice
Copy link
Owner

@lebrice lebrice commented Dec 13, 2022

WIP.

  • Add a whole bunch of tests for the subgroups feature (with nesting)
  • Make nested subgroups work
  • Make other tests work
  • Identify and mark out candidates for subsequent refactoring PRs. (out of scope, this is already a pretty large PR as-is).

@lebrice lebrice changed the title Rework of the subgroups feature + ArgumentParser Refactoring Rework of the subgroups feature + Refactoring Dec 13, 2022
@lebrice lebrice marked this pull request as ready for review January 5, 2023 21:23
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
The FieldWrapper is created for the subgroups arg.
I now create a new DataclassWrapper and graft add it as a child of the
DataclassWrapper that contains the subgroup field.

The current issue seems to be that the ConflictResolver is seeing both
the FieldWrapper and the DataclassWrapper (I Think) as pointing to the
same destination!

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
The `conflict_resolver.resolve` method was actually doing two things:
- Resolving conflicts
- Flattening the list!

This was causing confusion, since `wrappers` was secretely growing,
which was causing the issue with duplicates from before.

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
This is getting to the point where things are parsing, but the default
value for a part of the subgroup is wrong. Need to check what exactly is
going on.

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
I think I figured out the issue. If we generate a DataclassWrapper
for a subgroup, then it doesn't get a real `Field`, which might be
preventign the parsing from working properly?

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Certain things were breaking in basic tests.

TODOs left:
- Still getting some errors in the ALWAYS_MERGE case
- Still not parsing the right values for the other arguments

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
@lebrice lebrice changed the title Rework of the subgroups feature + Refactoring Rework of the subgroups feature + Minor Refactoring Jan 5, 2023
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
@lebrice
Copy link
Owner Author

lebrice commented Jan 6, 2023

Potential future improvements:

  • Show all possible subgroups in the "--help" action, not just the selected subgroups.
  • Make the subgroups function more flexible:
    • Allow passing partials or lambdas as default factories or subgroup options

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant