lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
399 stars 49 forks source link

Idea: Refactoring of the `FieldWrapper` class #150

Open lebrice opened 2 years ago

lebrice commented 2 years ago

Would be a good idea to refactor the FieldWrapper class a bit. The args_dict (a dict of all the argparse arguments for a given field, that get passed to parser.add_arguments in the FieldWrapper) is currently created using a mix of three things (with increasing priority):

These three are currently a bit mixed together in the FieldWrapper class. It would perhaps be preferable to have them be cleanly separated.

idoby commented 2 years ago

Yeah, it needs some love. I find it especially limiting that DataclassWrapper/FieldWrapper do too much by themselves and so injecting new information into the process is hard (e.g. creating a feature that has an effect at the field level but is specified as an argument to add_arguments())