flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] FlyteRemote for_endpoint method has config_file parameter incorrectly typed

Open ivanjut opened this issue 8 months ago • 3 comments

Describe the bug

Initializing a UnionRemote object like so: UnionRemote.for_endpoint(endpoint=UNION_ENDPOINT) gives a Pyright typing error:

Argument of type "None" cannot be assigned to parameter "config_file" of type "str | ConfigFile" in function "for_endpoint"

Looking at the source code (here), it appears the config_file parameter is not typed as Optional, but defaults to None, causing the typing error.

Expected behavior

I don't expect there to be a typing error upon UnionRemote initialization

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • [x] Yes

Have you read the Code of Conduct?

  • [x] Yes

ivanjut avatar May 14 '25 23:05 ivanjut

Thank you for opening your first issue here! 🛠

welcome[bot] avatar May 14 '25 23:05 welcome[bot]

You are correct: the FlyteRemote.for_endpoint method's config_file parameter is not typed as Optional, but its default value is None, which causes a Pyright typing error. The function signature is:

def for_endpoint( endpoint: str, insecure: bool = False, data_config: typing.Optional[DataConfig] = None, config_file: typing.Union[str, ConfigFile] = None, ... ) -> "FlyteRemote":

This means config_file should be typed as Optional[str | ConfigFile] to match the default value of None and avoid the typing error. This is a typing bug in the source code, not a runtime issue. See flytekit/remote/remote.py and API reference.

Would you like more detail on how to work around this or how to submit a fix?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @runllm to ask follow-up questions. See runllm.com for more!

runllm[bot] avatar May 14 '25 23:05 runllm[bot]

#take

popojk avatar May 18 '25 02:05 popojk