Skip to content

Commit edcd006

Browse files
committed
add explanations
1 parent f0e5947 commit edcd006

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

openml/_api/runtime/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def __init__(
2828
def build_backend(version: str, *, strict: bool) -> APIBackend:
2929
settings = Settings.get()
3030

31-
# Get config for v1 (lazy init from openml.config)
31+
# Get config for v1. On first access, this triggers lazy initialization
32+
# from openml.config, reading the user's actual API key, server URL,
33+
# cache directory, and retry settings. This avoids circular imports
34+
# (openml.config is imported inside the method, not at module load time)
35+
# and ensures we use the user's configured values rather than hardcoded defaults.
3236
v1_config = settings.get_api_config("v1")
3337

3438
http_cache = HTTPCache(
@@ -54,7 +58,11 @@ def build_backend(version: str, *, strict: bool) -> APIBackend:
5458
if version == "v1":
5559
return v1
5660

57-
# V2 support - will raise NotImplementedError if v2 config not available
61+
# V2 support. Currently v2 is not yet available,
62+
# so get_api_config("v2") raises NotImplementedError. When v2 becomes available,
63+
# its config will be added to Settings._init_from_legacy_config().
64+
# In strict mode: propagate the error.
65+
# In non-strict mode: silently fall back to v1 only.
5866
try:
5967
v2_config = settings.get_api_config("v2")
6068
except NotImplementedError:

0 commit comments

Comments
 (0)