<#1301 fix: degrade gracefully when keyring packag...
# flyte-github
a
#1301 fix: degrade gracefully when keyring package is missing (FLYTE-SDK-6N) Pull request opened by EngHabu Problem
KeyringStore
token caching is best-effort: `store`/`retrieve`/`delete` already swallow
NoKeyringError
and other keyring backend failures so auth can proceed without a cached token. But the
import keyring
at each call site was unguarded, so a broken/slim environment missing the
keyring
package raised
ModuleNotFoundError: No module named 'keyring'
that escaped through the auth flow. Sentry FLYTE-SDK-6N (on 2.5.6): the missing package surfaced as a hard crash of the entire
SelectCluster -> upload -> run
path:
Copy code
ModuleNotFoundError: No module named 'keyring'
  @ _keyring.retrieve
  @ client_credentials.__init__
  @ factory.get_async_authenticator
-> RuntimeError: SelectCluster failed for operation=1: No module named 'keyring'
-> RuntimeSystemError: Upload failed for /tmp/.../spec.pb (org='archipelago', ...)
keyring>=25.6.0
is a declared dependency, but partial/slim installs can still be missing it. Token caching is purely an optimization — a missing backend must degrade gracefully, not take down the run. Fix Guard the
import keyring
in all three call sites (`store`/`retrieve`/`delete`). A missing keyring package now degrades to "no cached tokens" (return credentials unchanged /
None
/ no-op), exactly matching how
NoKeyringError
is already handled. Tests 3 new regression tests force
import keyring
to raise
ImportError
(via
sys.modules["keyring"] = None
) and assert each method degrades instead of raising. 22/22 keyring-store tests pass. fixes FLYTE-SDK-6N 🤖 Generated with Claude Code flyteorg/flyte-sdk