From 6a8398d174c7732944755dbf0b3ddb7c57ec78ef Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Tue, 7 Jul 2026 09:06:27 -0400 Subject: [PATCH 1/2] docs: clarify is_initialized() semantics (SDK-2641) The is_initialized() docstring claimed the method returns true only after successfully connecting to LaunchDarkly. In reality it also returns true in offline mode, in LDD/daemon mode, and whenever a persistent store already has (possibly stale) cached data -- none of which require a live connection. Reword to align with the Go SDK's Initialized() documentation: describe it as 'initialized and has flag data available', note that offline/LDD always return true, warn that a true result does not guarantee flag data is up to date, and point to data_source_status_provider for connection status. Docstring only; no behavior change. --- ldclient/client.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/ldclient/client.py b/ldclient/client.py index 829575d4..c4bfe17e 100644 --- a/ldclient/client.py +++ b/ldclient/client.py @@ -464,12 +464,26 @@ def is_offline(self) -> bool: return self._config.offline def is_initialized(self) -> bool: - """Returns true if the client has successfully connected to LaunchDarkly. - - If this returns false, it means that the client has not yet successfully connected to LaunchDarkly. - It might still be in the process of starting up, or it might be attempting to reconnect after an - unsuccessful attempt, or it might have received an unrecoverable error (such as an invalid SDK key) - and given up. + """Returns whether the client is initialized and has flag data available to serve requests. + + If this returns true, it means the client has data it can use to evaluate flags. That could be + because it connected to LaunchDarkly at least once and received flag data, or because it has + cached data from a persistent store, or because it was configured for offline or LDD (daemon) + mode. It could still have encountered a connection problem after that point, and cached data may + not be current, so this does not guarantee that the flag data is up to date; if you need to know + the connection status in more detail, use :attr:`data_source_status_provider`. + + Additionally, if the client was configured to be offline or to use LDD (daemon) mode, this will + always return true. + + If this returns false, it means the client has not yet obtained any flag data. It might still be + starting up, or attempting to reconnect after an unsuccessful attempt, or it might have received + an unrecoverable error (such as an invalid SDK key) and given up. In this state, feature flag + evaluations will return default values -- unless you are using a persistent store integration and + flag data had already been stored by a successfully connected SDK in the past. You can use + :attr:`data_source_status_provider` to get information on errors, or to wait for a successful retry. + + :return: true if the client is initialized and has flag data available """ if self.is_offline() or self._config.use_ldd: return True From a30032ec40ca519c03c7fed25b0438ecec1e1d26 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Tue, 7 Jul 2026 15:37:38 -0400 Subject: [PATCH 2/2] docs: drop redundant offline/LDD callout in is_initialized() Per review: the standalone 'Additionally, offline/LDD always returns true' paragraph duplicated the offline/LDD case already listed in the first paragraph. Removed it. (The Go SDK keeps that callout only because its first paragraph does not mention offline.) --- ldclient/client.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ldclient/client.py b/ldclient/client.py index c4bfe17e..bba8914a 100644 --- a/ldclient/client.py +++ b/ldclient/client.py @@ -473,9 +473,6 @@ def is_initialized(self) -> bool: not be current, so this does not guarantee that the flag data is up to date; if you need to know the connection status in more detail, use :attr:`data_source_status_provider`. - Additionally, if the client was configured to be offline or to use LDD (daemon) mode, this will - always return true. - If this returns false, it means the client has not yet obtained any flag data. It might still be starting up, or attempting to reconnect after an unsuccessful attempt, or it might have received an unrecoverable error (such as an invalid SDK key) and given up. In this state, feature flag