You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the issue spamming- but here's a small bug report that this assertion needs to be replaced by an Exception to properly display which fields have issues in the defaults. I would submit a PR but I'll probably get the type of Exception to use wrong :D
Aha thanks! Partially addressed this by fixing the broken f-string, so the assertion error should be useful now.
Need to think about whether this should be converted to an exception.
I'm leaning slightly toward keeping it as an assert because (1) it doesn't seem like it would ever need to be caught, (2) code that causes this problem would usually be flagged by a type checker*, and (3) none of the existing custom exceptions (unsupported type annotations, instantiation errors, unsupported nested type errors, etc) seem like a good fit.
*I understand this isn't the case if you're dynamically reading defaults from a YAML. But I'm not sure it's tyro's responsibility if you have a field annotated as bool which actually contains a string. Egregious example:
importtyrodefmain(x: bool="False") ->None:
passtyro.cli(main) # Should trigger the same error.
Sorry for the issue spamming- but here's a small bug report that this assertion needs to be replaced by an Exception to properly display which fields have issues in the defaults. I would submit a PR but I'll probably get the type of Exception to use wrong :D
tyro/tyro/_arguments.py
Lines 198 to 201 in e88e690
The text was updated successfully, but these errors were encountered: