Skip to content

Conversation

@johanneskoester
Copy link

@johanneskoester johanneskoester commented Sep 11, 2023

This PR adds two things:

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

@mivade
Copy link
Owner

mivade commented Sep 18, 2023

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

@martinResearch
Copy link

Could you please add a test like I did in my draft PR? #60
thanks!

@vsoch
Copy link

vsoch commented Feb 21, 2024

Any progress here?

@johanneskoester
Copy link
Author

Sorry for the delay, I completely forgot. Testcase added.

@mivade
Copy link
Owner

mivade commented Nov 20, 2025

Looks like we still have some CI failures around formatting.

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.

make _add_dataclass_options public

4 participants