Describe the bug
Using the add_config_path_arg option in ArgumentParser causes other options to be ignored such as add_option_string_dash_variants, argument_generation_mode, and nested_mode.
To Reproduce
from dataclasses import dataclass, field
from simple_parsing import ArgumentParser, DashVariant
from simple_parsing.wrappers.field_wrapper import ArgumentGenerationMode, NestedMode
@dataclass
class NestedParams:
num_units: int = 4
@dataclass
class Params:
num_layers: int = 4
nested: NestedParams = field(default_factory=lambda: NestedParams())
parser = ArgumentParser(
add_config_path_arg=True,
add_option_string_dash_variants=DashVariant.DASH,
argument_generation_mode=ArgumentGenerationMode.NESTED,
nested_mode=NestedMode.WITHOUT_ROOT,
)
parser.add_arguments(Params, dest="params")
args = parser.parse_args()
parser.print_help()
Expected behavior
The expected output is
usage: test_add_config_path_dash.py [-h] [--num-layers int] [--nested.num-units int]
optional arguments:
-h, --help show this help message and exit
--config-path Path Path to a config file containing default values to use. (default: None)
Params ['params']:
Params(num_layers: int = 4, nested: __main__.NestedParams = <factory>)
--num-layers int (default: 4)
NestedParams ['params.nested']:
NestedParams(num_units: int = 4)
--nested.num-units int
(default: 4)
Actual behavior
The actual output is
usage: test_add_config_path_dash.py [-h] [--config_path Path] [--num_layers int] [--num_units int]
optional arguments:
-h, --help show this help message and exit
--config_path Path Path to a config file containing default values to use. (default: None)
Params ['params']:
Params(num_layers: int = 4, nested: __main__.NestedParams = <factory>)
--num_layers int (default: 4)
NestedParams ['params.nested']:
NestedParams(num_units: int = 4)
--num_units int (default: 4)
Desktop (please complete the following information):
Describe the bug Using the
add_config_path_arg
option in ArgumentParser causes other options to be ignored such asadd_option_string_dash_variants
,argument_generation_mode
, andnested_mode
.To Reproduce
Expected behavior The expected output is
Actual behavior The actual output is
Desktop (please complete the following information):