#2525 [Housekeeping] Improve typing compatibility
Issue created by
ossareh
### Describe the issue
pyright (and possibly mypy) seems to have an issue with inferring types.
In a test scenario we have this code:
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from flytekit import task, workflow
from flytekit.types.directory import FlyteDirectory
@dataclass_json
@dataclass
class SomeType:
src_dir: FlyteDirectory
int_arg: int
def test_sigproc_v2_flyte_task(tmpdir):
@task
def stub_task(src_dir: FlyteDirectory, int_arg: int):
return SomeType(src_dir=src_dir, int_arg=int_arg)
@workflow
def stub_workflow(
src_dir: FlyteDirectory,
int_arg: int,
) -> SomeType:
return stub_task(src_dir=src_dir, int_arg=int_arg)
stub_workflow(
src_dir=FlyteDirectory(str(tmpdir)),
int_arg=1,
)
Under pyright the following complaints are present for the
stub_workflow
call:
stub_workflow ( # <-- Argument missing for parameter "fn"
src_dir=FlyteDirectory(str(tmpdir)), # <-- No parameter named "src_dir"
int_arg=1, # <-- No parameter named "int_arg"
)
### What if we do not do this?
Lack of polish in the typed python world; unfortunately lots of visual noise while writing flyte task and workflows for those of us that have editors setup to warn on typing issues.
### Related component(s)
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flyte