Skip to main content

Production-ready feature flags library for Litestar

Project description

litestar-flags

Production-ready feature flags for Litestar applications.

PyPI version Python versions License

Installation

uv add litestar-flags

# With extras
uv add litestar-flags[redis]        # Redis backend
uv add litestar-flags[database]     # SQLAlchemy backend
uv add litestar-flags[workflows]    # Approval workflows
uv add litestar-flags[openfeature]  # OpenFeature SDK provider
uv add litestar-flags[prometheus]   # Prometheus metrics
uv add litestar-flags[observability] # OpenTelemetry + structlog
uv add litestar-flags[all]          # Everything

Quick Start

from litestar import Litestar, get
from litestar_flags import FeatureFlagsPlugin, FeatureFlagsConfig, FeatureFlagClient

config = FeatureFlagsConfig()
plugin = FeatureFlagsPlugin(config=config)

@get("/")
async def index(feature_flags: FeatureFlagClient) -> dict:
    if await feature_flags.is_enabled("new_checkout"):
        return {"flow": "new"}
    return {"flow": "legacy"}

app = Litestar(plugins=[plugin])

Features

  • Multiple backends - Memory, Redis, and SQLAlchemy storage
  • Percentage rollouts - Gradual releases with consistent hashing
  • User targeting - Rules based on user attributes
  • Segment-based targeting - Reusable user groups for complex targeting
  • A/B testing - Weighted variants for experiments
  • Time-based rules - Scheduled launches and maintenance windows
  • Multi-environment - Environment inheritance, promotion, and per-env configs
  • Admin API - REST endpoints for flag management with RBAC and audit logging
  • Analytics - Evaluation tracking, metrics, and Prometheus export
  • OpenFeature support - Vendor-agnostic evaluation via OpenFeature SDK
  • Approval workflows - Human-in-the-loop governance for enterprise use

Documentation

Full docs at flags.litestar.scriptr.dev.

Development

git clone https://github.com/JacobCoffee/litestar-flags.git
cd litestar-flags
uv sync --all-extras
uv run pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litestar_flags-0.2.1.tar.gz (172.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litestar_flags-0.2.1-py3-none-any.whl (218.9 kB view details)

Uploaded Python 3

File details

Details for the file litestar_flags-0.2.1.tar.gz.

File metadata

  • Download URL: litestar_flags-0.2.1.tar.gz
  • Upload date:
  • Size: 172.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for litestar_flags-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5f727f523034e536ec1a51abb07acddb1c3474e74a2664647a3506ffcec064b6
MD5 09edd3b95839ea7a3dae43acf51de2c3
BLAKE2b-256 8ecaf02a76d3626447d652303ad67111a73bd60391be6d563552c405fa6c218b

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_flags-0.2.1.tar.gz:

Publisher: publish.yml on JacobCoffee/litestar-flags

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file litestar_flags-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: litestar_flags-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 218.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for litestar_flags-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef4d519ec98f66915c9be16332baa453032e2b89f95e64c8890f1f0f3c5ac454
MD5 216087699b83d56fe24c842934f6703c
BLAKE2b-256 b74dc945008b3d17faec8aa8b2aac91ebc298e325888e6fa162cf7ad006a1f47

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_flags-0.2.1-py3-none-any.whl:

Publisher: publish.yml on JacobCoffee/litestar-flags

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page