peal.global_utils.add_class_arguments¶
- peal.global_utils.add_class_arguments(parser, config_class, base_str='')[source]¶
Add one command line argument per annotated config field.
Every annotation of
config_classbecomes--<base_str><name>with defaultNone, so that only the flags actually passed override the config file. Fields whose type is itself a*Configclass are recursed into with a dotted prefix (--data.input_size); forUniontypes the first member is inspected.- Parameters:
parser (
argparse.ArgumentParser) – Parser the arguments are added to, in place.config_class (
type) – A pydantic config class.base_str (
str, optional) – Dotted prefix for nested configs.