lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
399 stars 49 forks source link

Bug when mixing subgroups and "regular" dataclasses #138

Closed lebrice closed 2 years ago

lebrice commented 2 years ago

When mixing both, e.g.

@dataclass
class Config:
    person: Person = subgroups({
        "bob": Bob, "alice": Alice,
    }, default=Bob)

parser = ArgumentParser()
parser.add_arguments(Config, dest="config")
parser.add_arguments(Foo, dest="foo")

args = parser.parse_args()

Raises a RuntimeError("namespace shouldnt already have a "foo" attribute!")