-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
🐛 Bug report
When using the Type
annotation in conjunction with a TYPE_CHECKING
guarded import, e.g.
from typing import Type, TYPE_CHECKING
from jsonargparse import ArgumentParser
if TYPE_CHECKING:
from pytorch.lightning.cli import LightningCLI
def dummy(cli_cls: Type["LightningCLI"]):
print(cli_cls)
def main():
parser = ArgumentParser()
parser.add_function_arguments(dummy)
args = parser.parse_args()
I get the following error
ValueError: With fail_untyped=True, all mandatory parameters must have a supported type. Parameter 'cli_cls' from '__main__.test' does not specify a type.
Although, this parser set up works when removing the TYPE_CHECKING
guarded import, and importing directly
Expected behavior
Environment
- jsonargparse version: 4.3.1
- Python version: 3.9
- How jsonargparse was installed: poetry
- OS: linux
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working