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.1.0.tar.gz (22.0 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.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: signakit_flags-1.1.0.tar.gz
  • Upload date:
  • Size: 22.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 5ae9c05fb70370a8d9ece19d1ac5a91a55126d6a2dc4e7728e88b5b3fa0295f8
MD5 af1d8edca0b1be4e7cd96595b1b6e70e
BLAKE2b-256 9b4c8e22bef4172204850bba20049478d8a1db3fd1ae92bdd83037e9264b0de9

See more details on using hashes here.

Provenance

The following attestation bundles were made for signakit_flags-1.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: signakit_flags-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a8d79c3c6a05da24d1506a2e3d979e213f94ad4efd9c785a1a98ba2c15806a1
MD5 1971102415e485d567eea45f36e5a666
BLAKE2b-256 4dcafd82d317a0d2ebc81062ded137ec576a66a6570d70dd836edc5f160aa03f

See more details on using hashes here.

Provenance

The following attestation bundles were made for signakit_flags-1.1.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