argparse_dataclass icon indicating copy to clipboard operation
argparse_dataclass copied to clipboard

feat: make add_dataclass_options public, separate field extraction into public helper function

Open johanneskoester opened this issue 2 years ago • 3 comments
trafficstars

This PR adds two things:

  1. add_dataclass_options becomes a public function, which fixes #58
  2. 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.

johanneskoester avatar Sep 11 '23 08:09 johanneskoester

Looks like there is some typing issue that's failing on Python 3.8 but I haven't spotted what exactly it is yet.

mivade avatar Sep 18 '23 17:09 mivade

Could you please add a test like I did in my draft PR? https://github.com/mivade/argparse_dataclass/pull/60 thanks!

martinResearch avatar Sep 20 '23 20:09 martinResearch

Any progress here?

vsoch avatar Feb 21 '24 02:02 vsoch