<#4098 [Core feature] Allow dictionaries to be pas...
# flytekit
a
#4098 [Core feature] Allow dictionaries to be passed to execute workflows that take dataclasses Issue created by curlywurlycraig Motivation: Why do you think this is important? When using flytekit to execute a workflow in Flyte, if the workflow takes a dataclass it is not always feasible to pass an instance of that same dataclass to flytekit (for example, if flytekit is being run from some location/project that does not have access to the dataclass defined in the same package that is used in the workflow). Goal: What should the final outcome look like, ideally? When calling
flytekit_client.execute
on a workflow that takes a dataclass, passing a plain dictionary with the same shape as the dataclass should execute successfully. For example:
Copy code
# In my workflow:
@dataclass_json
@dataclass
class Data:
    a: int
    b: str

@workflow
def my_wf(x: list[Data]) -> int:
    ...
I should be able to call:
Copy code
execution = flytekit_remote.execute(
    my_workflow,
    [{ "a": 10, "b": "hello" }]
)
Describe alternatives you've considered If a flyte workflow takes a dataclass as an input, the flyte type that comes back in the workflow interface is a dataclass, so the execution expects a dataclass as input. Otherwise the type engine attempts to read the input as a dataclass and fails. Other possible solutions to this are: 1. Determine type hints from input shape (losing some type checking) 2. Determine type hints from workflow input somehow, using the flyte types. 3. Have workflows accept primitive dicts instead of dataclasses (also losing valuable typechecking and reusability) Propose: Link/Inline OR Additional context No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte