Skip to content

Commit f1b26ca

Browse files
mhotanclaude
andcommitted
cli(proxy): lazily import flyte.remote to keep CLI startup fast
Addresses review feedback: the flyte.remote client stack is heavy and was imported at module top, slowing every 'flyte' CLI invocation. Move it into the app command's name-resolution branch so it only loads when resolving an app by name (the --url path skips it entirely). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fe7405c commit f1b26ca

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/flyte/cli/_proxy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import rich_click as click
77

8-
import flyte.remote as remote
9-
108
from . import _common as common
119

1210
# Headers that must not be forwarded verbatim across a proxy hop.
@@ -67,6 +65,10 @@ def app(
6765
if url:
6866
target = url
6967
elif name:
68+
# Lazy import: keeps `flyte` CLI startup fast — the heavy remote client stack
69+
# only loads when resolving an app by name (the --url path skips it entirely).
70+
import flyte.remote as remote
71+
7072
target = remote.App.get(name=name).endpoint
7173
else:
7274
raise click.UsageError("Provide an app NAME or --url.")

0 commit comments

Comments
 (0)