Skip to main content

Feature-flag primitive for Flametrench: boolean flags with authz targeting and deterministic percentage rollouts (ADR 0021).

Project description

flametrench-flags

Feature-flag primitive for the Flametrench v0.4 platform (ADR 0021).

What this is

Boolean flags with two targeting rule types:

  • authz — matches subjects that pass an authz check() (e.g. "editors of org O"). Targeting reuses the application's real authorization model; no separate DSL.
  • percentage — deterministic SHA-256 rollout bucket, sticky and monotonic. Pinned for byte-identical behavior across all Flametrench SDKs.

Install

pip install flametrench-flags

Requires Python ≥ 3.11 and flametrench-ids >= 0.4.0.

Quick start

from flametrench_flags import InMemoryFlagStore

store = InMemoryFlagStore()

store.create_flag(
    scope="org_...",
    key="new-checkout",
    enabled=True,
    default_variant=False,
    rules=[
        {"kind": "authz", "relation": "editor",
         "object": {"type": "org", "id": "org_..."}, "variant": True},
        {"kind": "percentage", "basis_points": 1000, "variant": True},
    ],
)

# Evaluate: inject your authz check_fn
result = store.evaluate(
    "new-checkout",
    subject_id="usr_...",
    scope="org_...",
    check_fn=lambda subj, rel, ot, oid: authz_store.check(subj, rel, ot, oid),
)

License

Apache-2.0 © NDC Digital, LLC

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

flametrench_flags-0.4.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

flametrench_flags-0.4.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file flametrench_flags-0.4.0.tar.gz.

File metadata

  • Download URL: flametrench_flags-0.4.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flametrench_flags-0.4.0.tar.gz
Algorithm Hash digest
SHA256 21bb551bbf05dd18d0879338b3979b91137ff71ca6a0db1f45cb57838e753d0c
MD5 d67f3b31e25cec479a77880e6e6899d3
BLAKE2b-256 1dcc637ad13d10c84c691448d986c4202646e32e4f80d4627d93ee73dc2fb56a

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametrench_flags-0.4.0.tar.gz:

Publisher: publish.yml on flametrench/flags-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 flametrench_flags-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flametrench_flags-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eced4ebc397090771ba53b7b0f8055d3f57475878d84c8f0ef1b3b53f27594e2
MD5 869e89b30c53cd109247ab071d26d804
BLAKE2b-256 0f7b424c51a49393f02359850339a1743217f8372535d5fc93deb43d129e6c19

See more details on using hashes here.

Provenance

The following attestation bundles were made for flametrench_flags-0.4.0-py3-none-any.whl:

Publisher: publish.yml on flametrench/flags-python

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