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.0.tar.gz (172.1 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.0-py3-none-any.whl (219.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: litestar_flags-0.2.0.tar.gz
  • Upload date:
  • Size: 172.1 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.0.tar.gz
Algorithm Hash digest
SHA256 865a86b92614154951994ce153214c9477ec371c9dec433733b5d19c207d2f2f
MD5 286a23f134c26d28bb0dedc5e8d3d032
BLAKE2b-256 ef19a03768bd30cbff15ae9f4236d662fc4fb0066d191bb7e2bedb84145b6c89

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_flags-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: litestar_flags-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 219.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b0ada073d56e1a1700cb4f638411a83d8fdc183de54b6598fd1399c9e47fc55
MD5 d15e59dee39fd18c7498ca5abad26fd2
BLAKE2b-256 2b05261b366ebf0ca3bb717481cab05f67c8b8efea6dffb4be3fefca6be81505

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_flags-0.2.0-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