-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
🐛 Bug report
Empty tuples are not supported by the parser.
To reproduce
from dataclasses import dataclass
from jsonargparse import ArgumentParser
@dataclass
class TestCfg:
a: tuple[int, ...] = ()
if __name__ == "__main__":
parser = ArgumentParser(description="CLI for training models", exit_on_error=False)
parser.add_argument("test", type=TestCfg)
args = parser.parse_args()
print(args)
Running the following program without passing any arguments or by passing an empty list/tuple "[]"
results in the following error:
argparse.ArgumentError: Validation failed: Parser key "test.a":
Expected a non-empty tuple. Got value: []
Expected behavior
To be able to parse empty tuples without errors.
Environment
- jsonargparse version: 4.33.1
- Python version: 3.10
- How jsonargparse was installed: pip
- OS: MacOS
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working