Optional[list] is not working with callbacks #762
-
First Check
Commit to Help
Example Codeimport typer
import typing as tp
app = typer.Typer(name="abc")
def callback(
ctx: typer.Context,
param: typer.CallbackParam,
value: tp.List[str] | None
) -> tp.List[str] | None:
return value
@app.command("test", help="Test")
def test_cmd(
abc: tp.Optional[tp.List[str]] = typer.Option(
None, "--abc", "-a", help="abc", show_default=False,
callback=callback,
),
) -> None:
print(abc)
@app.callback()
def main():
pass
if __name__ == "__main__":
app() Description
Operating SystemmacOS Operating System DetailsNo response Typer Version0.12.3 Python VersionPython 3.11.8 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Can reproduce on 12.5 version UPD: the fix is here #1018 |
Beta Was this translation helpful? Give feedback.
-
I am experiencing the same issue. The problems occurs when the default value converter |
Beta Was this translation helpful? Give feedback.
-
Fix is here #1018 |
Beta Was this translation helpful? Give feedback.
Fix is here #1018