From b10121d8113e80f35515f7b605d6ec72c0c77aa2 Mon Sep 17 00:00:00 2001 From: machichima Date: Sun, 24 Aug 2025 11:20:09 +0800 Subject: [PATCH 1/2] fix: type error when setting default val as FlyteFile -e Signed-off-by: machichima --- flytekit/interaction/click_types.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flytekit/interaction/click_types.py b/flytekit/interaction/click_types.py index 7918339da3..783d9da2fa 100644 --- a/flytekit/interaction/click_types.py +++ b/flytekit/interaction/click_types.py @@ -158,6 +158,11 @@ def convert( ) -> typing.Any: if isinstance(value, ArtifactQuery): return value + + # If value is already a FlyteFile, return it as-is to avoid creating nested FlyteFile objects + if isinstance(value, FlyteFile): + return value + # set remote_directory to false if running pyflyte run locally. This makes sure that the original # file is used and not a random one. remote_path = None if getattr(ctx.obj, "is_remote", False) else False @@ -177,6 +182,7 @@ class PickleParamType(click.ParamType): def get_metavar(self, param: Parameter, ctx: Context) -> t.Optional[str]: return "Python Object :" + else: def get_metavar(self, param: Parameter, *args) -> t.Optional[str]: From c7014ac7fd32d26b8294096df607d62b053e9bb4 Mon Sep 17 00:00:00 2001 From: machichima Date: Sun, 24 Aug 2025 15:54:23 +0800 Subject: [PATCH 2/2] fix: merge type checks -e Signed-off-by: machichima --- flytekit/interaction/click_types.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flytekit/interaction/click_types.py b/flytekit/interaction/click_types.py index 783d9da2fa..056fa2db61 100644 --- a/flytekit/interaction/click_types.py +++ b/flytekit/interaction/click_types.py @@ -156,11 +156,7 @@ class FileParamType(click.ParamType): def convert( self, value: typing.Any, param: typing.Optional[click.Parameter], ctx: typing.Optional[click.Context] ) -> typing.Any: - if isinstance(value, ArtifactQuery): - return value - - # If value is already a FlyteFile, return it as-is to avoid creating nested FlyteFile objects - if isinstance(value, FlyteFile): + if isinstance(value, (ArtifactQuery, FlyteFile)): return value # set remote_directory to false if running pyflyte run locally. This makes sure that the original