-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make _add_dataclass_options public #58
Comments
I don't see why not. Feel free to make a pull request! |
I think making It is only one step in the process of initializing the dataclass. It configures the |
I might not be fully understanding your use case but it seems like Example import argparse
from dataclasses import dataclass
from argparse_dataclass import parse_known_args
@dataclass
class DataclassArgs:
name: str
clear: bool
def main():
dc_args, remaining = parse_known_args(DataclassArgs)
parser = argparse.ArgumentParser()
parser.add_argument("--foo", action="store_true")
args = parser.parse_args(remaining)
print(dc_args)
print(args)
if __name__ == "__main__":
main() usage $ python ex_argparse_dataclass.py --name "Fred" --foo
DataclassArgs(name='Fred', clear=False)
Namespace(foo=True) |
Hi,
I would like to be able to use
_add_dataclass_options directly
in some of my code in order to be able to continue using normal argparse.ArgumentParser instances and use a dataclass to define only a subset of my script arguments.Would it be possible to expose _add_dataclass_options as a public function i.e. remove the initial underscore?
The text was updated successfully, but these errors were encountered: