acoustic-carpenter-78188
08/19/2023, 5:39 AMdataclass_json decorator, the dataclass constructors are obscured, and we get pyright errors just instantiating them:
import flytekit.configuration as flyte_config
# Error: Argument missing for parameter "cls"
# Error: Expected no arguments to "DataClassJsonMixin" constructor
fast_serialization_settings = flyte_config.FastSerializationSettings(
enabled=True,
destination_dir=".",
distribution_location=".",
)
As it says in the dataclasses-json README, we can inherit from dataclasses_json.DataClassJsonMixin instead for improved static type checking.
TL;DR
This one change eliminates 467 of the 1715 existing pyright errors (27.2%) from the flytekit module.
Type
☑︎ Bug Fix
☐ Feature
☐ Plugin
Are all requirements met?
☑︎ Code completed
☐ Smoke tested
☐ Unit tests added
☐ Code documentation added
☐ Any pending items have an associated Issue
Complete description
@dataclass_json
@dataclass
class EntrypointSettings:
...
now becomes
@dataclass
class EntrypointSettings(DataClassJsonMixin):
...
And now there are no longer any pyright errors when instantiating any dataclasses.
flyteorg/flytekit
✅ All checks have passed
30/30 successful checksacoustic-carpenter-78188
08/21/2023, 9:18 PM