argparse_dataclass
argparse_dataclass copied to clipboard
feat: make add_dataclass_options public, separate field extraction into public helper function
trafficstars
This PR adds two things:
add_dataclass_optionsbecomes a public function, which fixes #58- I have separated the logic that infers args and kwargs for add_argument into a separate public helper function. This allows to further customize the added argument if needed. We use this in https://github.com/snakemake/snakemake-interface-executor-plugins to add additional arguments that are needed for e.g. utilizing the configargparse package in combination with argparse_dataclass.
I apologize for the mixed up diff. In fact, field_to_argument_args is just an exact copy of the inner loop that was formerly implemented in add_dataclass_options.
Also note that this PR does not introduce a breaking change, it just adds to the public API the two functions.
Looks like there is some typing issue that's failing on Python 3.8 but I haven't spotted what exactly it is yet.
Could you please add a test like I did in my draft PR? https://github.com/mivade/argparse_dataclass/pull/60 thanks!
Any progress here?