[BUG] FlyteRemote for_endpoint method has config_file parameter incorrectly typed
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
Thank you for opening your first issue here! 🛠
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!
#take