Create new Argument
class for options
#5152
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
I've looked into
argparse
and the move fromoptparse
towards it. This is still a long road ahead. We would need to rewrite (almost) every bit of code dealing with options and config.I've thought about the best way to do this and think the best way might be to start preparing the codebase by duplicating some functionality/data and slowly preparing a final move. It helps that the terminology of
argparse
relies onarguments
instead ofoptions
, which allows duplicating methods and attributes with similar though different names.Before continuing with this I would like some response from maintainers if this is indeed the best way to do this, or if there are other ways to allow for a gradual change to
argparse
.This PR is a first step towards this gradual transformation. I have created a new
NamedTuple
and one that inherits from it. These are based on the parameters we would eventually need to pass toArgumentParser.add_argument()
. For now I would suggest to add duplicate alloptions
of all checkers into anarguments
attributes. If all checkers have anarguments
attribute we can then start working on methods that utilise this (for example the documentation creation methods).The
StoreArgument
is probably not the only type of subclassedNamedTuple
I will need to create to do this, but serves as an example of how subclassingArgument
would work.TLDR: 1) Is temporary duplication the best way to facilitate the move towards
argparse
? 2) Is the use ofArgument
NamedTuples
's a good way to storearguments
data?