Production-ready feature flags library for Litestar
Project description
litestar-flags
Production-ready feature flags for Litestar applications.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865a86b92614154951994ce153214c9477ec371c9dec433733b5d19c207d2f2f
|
|
| MD5 |
286a23f134c26d28bb0dedc5e8d3d032
|
|
| BLAKE2b-256 |
ef19a03768bd30cbff15ae9f4236d662fc4fb0066d191bb7e2bedb84145b6c89
|
Provenance
The following attestation bundles were made for litestar_flags-0.2.0.tar.gz:
Publisher:
publish.yml on JacobCoffee/litestar-flags
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_flags-0.2.0.tar.gz -
Subject digest:
865a86b92614154951994ce153214c9477ec371c9dec433733b5d19c207d2f2f - Sigstore transparency entry: 781993650
- Sigstore integration time:
-
Permalink:
JacobCoffee/litestar-flags@d1de4babf2896c2278d5ff5789f333b8a5a5ee6a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JacobCoffee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d1de4babf2896c2278d5ff5789f333b8a5a5ee6a -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b0ada073d56e1a1700cb4f638411a83d8fdc183de54b6598fd1399c9e47fc55
|
|
| MD5 |
d15e59dee39fd18c7498ca5abad26fd2
|
|
| BLAKE2b-256 |
2b05261b366ebf0ca3bb717481cab05f67c8b8efea6dffb4be3fefca6be81505
|
Provenance
The following attestation bundles were made for litestar_flags-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on JacobCoffee/litestar-flags
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_flags-0.2.0-py3-none-any.whl -
Subject digest:
6b0ada073d56e1a1700cb4f638411a83d8fdc183de54b6598fd1399c9e47fc55 - Sigstore transparency entry: 781993651
- Sigstore integration time:
-
Permalink:
JacobCoffee/litestar-flags@d1de4babf2896c2278d5ff5789f333b8a5a5ee6a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JacobCoffee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d1de4babf2896c2278d5ff5789f333b8a5a5ee6a -
Trigger Event:
push
-
Statement type: