Skip to main content

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

  • Flags are declared via the framework register_feature_flags hook (FeatureFlagDefinition(name, default_enabled=...)); the module persists only overrides in the feature_flags_override SQLModel table (scoped by scope / scope_id).
  • FeatureFlagRegistry.is_enabled("flag.name", tenant_id=...) consumer API (resolution order: tenant override > system override > declared default).
  • Admin UI at /feature_flags — toggle flags, add per-scope overrides.
  • The registry is an in-memory cache hydrated from the DB so checking a flag on every request is cheap.

Usage

Declare a flag in your module:

from simple_module_core.feature_flags import FeatureFlagDefinition, FeatureFlagRegistry


class OrdersModule(ModuleBase):
    def register_feature_flags(self, registry: FeatureFlagRegistry) -> None:
        registry.add(FeatureFlagDefinition(name="orders.new_pricing_engine", default_enabled=False))

Gate a route using the registry dependency:

from fastapi import APIRouter, HTTPException

from feature_flags.deps import FeatureFlagRegistryDep  # type: ignore[import-not-found]

router = APIRouter()


@router.get("/new-feature")
async def new_feature(flags: FeatureFlagRegistryDep):
    if not flags.is_enabled("orders.new_pricing_engine"):
        raise HTTPException(404)
    return {"rolled_out": True}

Overrides (system or per-tenant) are managed through the admin UI at /feature_flags.

Depends on

  • simple_module_core, simple_module_db, simple_module_hosting

License

MIT — see LICENSE.

Download files

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

Source Distribution

simple_module_feature_flags-0.0.27.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

simple_module_feature_flags-0.0.27-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file simple_module_feature_flags-0.0.27.tar.gz.

File metadata

File hashes

Hashes for simple_module_feature_flags-0.0.27.tar.gz
Algorithm Hash digest
SHA256 acb9a2edb4d47b7d9c5fa82f68f4bbe408fcdb0dff9fa0dee65b06c6f9d4bf9c
MD5 b5e16048287a9bcdaa3a97570301fe0d
BLAKE2b-256 7e29a195f749efb08c9448aa08c56569b0320da8608cca54f8b9ee8e17a9f61f

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_feature_flags-0.0.27.tar.gz:

Publisher: release.yml on antosubash/simple_module_python

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

File details

Details for the file simple_module_feature_flags-0.0.27-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_module_feature_flags-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e8ffa9e771fcbf0e7ea2f854053a420fe2cb4ff50d694bb46011731b2cefd5
MD5 9048d47e982dafabaefce0686f57a4ab
BLAKE2b-256 931e1e0709d1a2a56436301436bbf17182d8af5171eb6ec067305cf7656a4ef3

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_feature_flags-0.0.27-py3-none-any.whl:

Publisher: release.yml on antosubash/simple_module_python

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

Release history Release notifications | RSS feed

0.0.33

2 files

0.0.32

2 files

0.0.31

2 files

0.0.30

2 files

0.0.29

2 files

0.0.28

2 files

This release

0.0.27 This release

2 files

0.0.26

2 files

0.0.25

2 files

0.0.24

2 files

0.0.23

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page