fastware v0.1.0 /src.fastware.features
On this page

Boolean feature flags with per-machine JSON overrides, providing enabled/disabled checks, runtime toggle, and hot reload for gradual rollouts.

#src.fastware.features

#src.fastware.features

Boolean feature flags with per-machine JSON overrides, providing enabled/disabled checks, runtime toggle, and hot reload for gradual rollouts.

Apps declare flags with defaults at startup. Overrides are loaded from a JSON file whose path is provided by the app. API: enabled(name), all_flags(), set_override(name, value), reload().

#FeatureFlags

Feature flag store with defaults and optional file-based overrides.

Parameters


defaults: Mapping of flag name to default boolean value. overrides_path: Optional path to a JSON file containing per-machine overrides. If None or the file does not exist, all flags use defaults.

#_load_overrides

python
def _load_overrides(self) -> dict[str, bool]

Read overrides from disk, returning {} on missing/malformed file.

#enabled

python
def enabled(self, name: str) -> bool

Check whether a feature flag is enabled.

#all_flags

python
def all_flags(self) -> dict[str, bool]

Return the effective state of every known flag.

#set_override

python
def set_override(self, name: str, value: bool) -> None

Set an override and persist to the JSON file.

Raises RuntimeError if no overrides path was configured.

#reload

python
def reload(self) -> None

Re-read overrides from the file on disk.