cuddly-jelly-27016
06/11/2025, 9:25 PMworkflow with an optional date parameter, we cannot call this from the CLI.
Workflow definition:
@workflow
def ingest_data(
start_date: Optional[date] = None,
) -> None:
pass
Executing the workflow:
pyflyte run --copy all -p flyte-snacks -d development --remote workflow.py ingest_data --start_date 2025-06-10
Produces this error:
Invalid value for '--start_date': Failed to convert param: <Option start_date>, value: 2025-06-10 00:00:00 to type: typing.Optional[datetime.date]. Reason
Cannot convert from 2025-06-10 00:00:00 to typing.Optional[datetime.date]
## What changes were proposed in this pull request?
We are now making sure to use the non-None variant when trying to do the conversion.
https://bito.ai#summarystart|
### Summary by Bito
This pull request enhances the CLI's handling of optional date parameters by introducing a new DateType class and correcting type conversion issues, specifically for optional datetime.date types. This improvement prevents type mismatch errors and ensures correct interpretation, thereby enhancing user experience when executing workflows with date parameters.
flyteorg/flytekit