Skip to main content

Official Python SDK for SignaKit Feature Flags.

Project description

@signakit/flags-python

Official Python SDK for SignaKit Feature Flags.

Fetches flag configurations from SignaKit's CloudFront CDN and evaluates them locally with consistent bucketing across all SignaKit SDKs (Node.js, Browser, React, PHP, Laravel, Python).

  • Async-first — async/await with httpx (sync API also available)
  • Type-safemypy --strict clean, fully type-annotated
  • Cross-language consistent — MurmurHash3-based bucketing produces the same variation for the same userId in every SDK
  • Bot detection — bots get the off variation and are excluded from events
  • Targeted-rule exposures skipped — exposure events are only fired for experiments (A/B tests, multi-armed bandits), not for simple feature rollouts

Installation

pip install signakit-flags

Requires Python 3.11+.

Quick start

import asyncio

from signakit_flags import SignaKitClient


async def main() -> None:
    client = SignaKitClient(sdk_key="sk_dev_orgId_projectId_random")

    ready = await client.on_ready()
    if not ready.success:
        print(f"SignaKit not ready: {ready.reason}")
        return

    user = client.create_user_context(
        user_id="user-123",
        attributes={"plan": "premium", "country": "US"},
    )
    if user is None:
        return

    decision = user.decide("new-checkout-flow")
    if decision and decision.enabled:
        # Show the new checkout flow
        ...

    # Track a conversion event with revenue
    await user.track_event("purchase", value=99.99, metadata={"sku": "abc"})


asyncio.run(main())

Synchronous usage

from signakit_flags import SignaKitClient

client = SignaKitClient(sdk_key="sk_prod_orgId_projectId_random")
ready = client.on_ready_sync()
if ready.success:
    user = client.create_user_context("user-123")
    decision = user.decide("new-checkout-flow") if user else None

API surface

Symbol Description
SignaKitClient(sdk_key=...) Create a client. Validates the key shape.
await client.on_ready() / client.on_ready_sync() Fetch the config and mark the client ready.
client.create_user_context(user_id, attributes) Build a per-user evaluator.
ctx.decide(flag_key)Decision | None Evaluate a single flag.
ctx.decide_all()dict[str, Decision] Evaluate every non-archived flag.
await ctx.track_event(event_key, value=..., metadata=...) Fire a conversion event.
is_bot(user_agent) Standalone bot-UA detector.
parse_sdk_key(key) Decode an SDK key into org/project/environment.

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

signakit_flags-1.0.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

signakit_flags-1.0.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file signakit_flags-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for signakit_flags-1.0.0.tar.gz
Algorithm Hash digest
SHA256 41e3138a87b962656452e70f7917a0f2c63624c72b8dde5dad9238fdc86fcea7
MD5 af442b8e88d5859608eb8566429f3376
BLAKE2b-256 060ed11086b948feceae87bb86727f5c6d5769a86fa0b86b0ceff62ea66c49d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for signakit_flags-1.0.0.tar.gz:

Publisher: publish-python.yml on SignaKit/signakit

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

File details

Details for the file signakit_flags-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: signakit_flags-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for signakit_flags-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 650c2010cbf804cade4386425c798053772e6720efe1f4f85f93d6548792c420
MD5 f4c00aab4d72ac0394f0f13b8a0905ff
BLAKE2b-256 28900787c8399cf8d853afc8f1b285d3703dd8da168170a1da120d30fd715744

See more details on using hashes here.

Provenance

The following attestation bundles were made for signakit_flags-1.0.0-py3-none-any.whl:

Publisher: publish-python.yml on SignaKit/signakit

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