<#3864 [Core feature] Enable dataclass attribute a...
# flyte-github
a
#3864 [Core feature] Enable dataclass attribute access in workflows Issue created by franzigeiger Motivation: Why do you think this is important? I'd like to access dataclass attributes from within a workflow. This is already possible for
NamedTuple
but those are restricted in usage. Goal: What should the final outcome look like, ideally? I would like this to work:
Copy code
@dataclass
@dataclass_json
class Config:
    x:int
    y:int
    z:int
    some_unused_additional_config:list[str]

@task
def add(x:int, y:int):
    return x+y
@workflow
def do_something(config:Config):
    add(config.x, config.y)
Describe alternatives you've considered Currenlty this is only possible with workarounds. You can: • Make the workflow dynamic • Use
NamedTuples
only if the configuration object is an output of another workflow. They can't be a task or workflow input. • Change the
add
task signatures to take in the full config object, which means taking in unused parameters. 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