Coverage for src/lexigram/features/constants.py: 87%
15 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 01:53 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 01:53 +0800
1"""Constants for the feature-flag subsystem.
3Defines typed defaults and environment variable prefixes used across the
4feature-flag system. Configuration models reference these to avoid
5hard-coding values in multiple places.
6"""
8from __future__ import annotations
10import importlib.metadata
12# -- Version -------------------------------------------------------------------
14try:
15 __version__: str = importlib.metadata.version("lexigram-features")
16except ImportError:
17 __version__ = "0.0.0"
19# -- Environment Variable Prefixes -------------------------------------------
21ENV_PREFIX: str = "LEX_FLAG_"
22"""Default prefix for environment variable flag definitions."""
24ENV_NESTED_DELIMITER: str = "__"
25"""Nested delimiter for environment variable configuration."""
28# -- Default Configuration Values --------------------------------------------
30DEFAULT_CACHE_TTL: int = 300
31"""Default TTL in seconds for cached flag evaluations (5 minutes)."""
33DEFAULT_ENABLED: bool = False
34"""Default evaluation result when a flag is not found, or when a rule is
35unconfigured (fail-closed)."""
37__all__ = [
38 "DEFAULT_CACHE_TTL",
39 "DEFAULT_ENABLED",
40 "ENV_NESTED_DELIMITER",
41 "ENV_PREFIX",
42]