Python API
import detentThe detent extension module is built with pybind11 when
DETENT_BUILD_PYTHON=ON.
detent.Client
Section titled “detent.Client”detent.Client( defaults_path: str, source_path: str | None = None, cli_overrides: list[str] = [], poll_interval_ms: int = 200,)Constructs a client with the given baked defaults and, optionally, a file
source. Raises detent.DetentError for missing or invalid defaults and invalid
CLI overrides.
Client.get(name: str, hash_val: str | None = None, switch_val: str | None = None) -> intReads a knob’s int64 value with the standard precedence.
get_bool
Section titled “get_bool”Client.get_bool(name: str, hash_val: str | None = None, switch_val: str | None = None) -> boolCalls get, then returns False for 0 and True for 1. Any other value
raises detent.DetentError with category ConversionFailed.
health
Section titled “health”Client.health() -> dict{'initialized': True, 'source_connected': True, 'accepted_version': 7, 'staleness_seconds': 0.4, 'knobs': 3, 'cli_overrides': 0}detent.DetentError
Section titled “detent.DetentError”Raised for every construction and read failure. The message starts with the error category:
try: client.get("search:nope")except detent.DetentError as e: print(e) # MissingKnob: search:nope (not present in current snapshot)Reads are in-memory and non-blocking.