Skip to content
GitHub

Quickstart

Install the package:

Terminal window
uv add lexigram-features
import asyncio
from lexigram import Application
from lexigram.features import FeatureFlagsModule, FeatureFlagsConfig
async def main() -> None:
config = FeatureFlagsConfig(initial_flags={"new_checkout": True})
async with Application.boot(name="my-app", modules=[FeatureFlagsModule.configure(config=config)]) as app:
from lexigram.contracts.feature_flags import FlagProviderProtocol
flags = await app.container.resolve(FlagProviderProtocol)
enabled = await flags.get_flag("new_checkout")
print(f"new_checkout enabled: {enabled}") # True
asyncio.run(main())
  • FeatureFlagsModule.configure() registered FlagProviderProtocol and FlagManager singletons in the container
  • The LocalProvider was seeded with new_checkout → True from initial_flags
  • FlagProviderProtocol.get_flag() evaluated the flag synchronously from the in-memory store
  • Guide — mental model, flag types, evaluation, decorators
  • Architecture — provider, backends, contracts, lifecycle
  • Configuration — cache TTL, env prefix, initial flags
  • How-Tos — percentage rollouts, A/B testing, feature gates