kiran
03/29/2023, 8:50 PMtyper
(not Prefect params) work with optional None
? E.g., this only works when it’s not a flow:
from typing import Optional
import typer
from prefect import flow
# @flow
def load_ids_flow(
file_date: Optional[str] = typer.Argument(None),
) -> None:
if file_date:
print(f"File date is {file_date}")
else:
file_date = typer.prompt("What's the file date in YYYYMMDD?")
print(f"You've entered {file_date}")
# do something else with this file date...
if __name__ == "__main__":
typer.run(load_ids_flow)
TypeError: Object of type 'ArgumentInfo' is not JSON serializable