Simple feature-flag module with per-tenant overrides and a consumer API for simple_module
Project description
simple_module_feature_flags
Feature flags for simple_module apps. Global flags with per-tenant overrides, a tiny consumer API, and no external service to run.
Install
pip install simple_module_feature_flags
What it provides
FlagandTenantFlagOverrideSQLModel tables.is_enabled("flag.name", tenant_id=...)consumer API.- Admin UI at
/feature-flags/admin— toggle flags, add tenant overrides. - Cache layer so checking a flag on every request is cheap.
Usage
Gate a route:
from feature_flags import is_enabled # type: ignore[import-not-found]
from fastapi import APIRouter, Depends, HTTPException
router = APIRouter()
@router.get("/new-feature")
async def new_feature(tenant_id: int = Depends(current_tenant_id)):
if not await is_enabled("orders.new_pricing_engine", tenant_id=tenant_id):
raise HTTPException(404)
return {"rolled_out": True}
Seed a flag in a migration or admin UI:
# via migration
Flag(name="orders.new_pricing_engine", enabled=False)
Tenant override:
TenantFlagOverride(tenant_id=7, flag_name="orders.new_pricing_engine", enabled=True)
Depends on
simple_module_core,simple_module_db,simple_module_hosting
License
MIT — see LICENSE.
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 simple_module_feature_flags-0.0.1.tar.gz.
File metadata
- Download URL: simple_module_feature_flags-0.0.1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e97e58b2d57803a017ef03d2e54bdf64553bdc126d8c3acaa4a65d3824b0fb
|
|
| MD5 |
6d66fa62b876e15d8291e2da8e49cb8b
|
|
| BLAKE2b-256 |
90caf9155418467be1f018a39075926d0a93491d97ec94f207c0e8d1ffa6b3b9
|
Provenance
The following attestation bundles were made for simple_module_feature_flags-0.0.1.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_feature_flags-0.0.1.tar.gz -
Subject digest:
33e97e58b2d57803a017ef03d2e54bdf64553bdc126d8c3acaa4a65d3824b0fb - Sigstore transparency entry: 1358380374
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_feature_flags-0.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_module_feature_flags-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ce50ddacc09a461ea9f7b2d7fd26ace9db23c55c6ddabacef5ef47c44d01f9
|
|
| MD5 |
eeb58fac2751f943255670bdc4ec5a94
|
|
| BLAKE2b-256 |
086f38037bd66dff9895076af64f594306acf93ae1a7e4604972aa90f90f411f
|
Provenance
The following attestation bundles were made for simple_module_feature_flags-0.0.1-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_feature_flags-0.0.1-py3-none-any.whl -
Subject digest:
64ce50ddacc09a461ea9f7b2d7fd26ace9db23c55c6ddabacef5ef47c44d01f9 - Sigstore transparency entry: 1358380412
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Trigger Event:
workflow_dispatch
-
Statement type: