Skip to main content

feat feature-flag SDK for Python (server-side, local evaluation)

Project description

feat.so


feat Python SDK

Server-side Python SDK for feat feature flags. Local flag evaluation against a polled datafile. Zero runtime dependencies (stdlib only).

Install

pip install feat-sdk

Python 3.10+.

Usage

from feat import Client, ClientConfig, EvalContext

client = Client(ClientConfig(
    api_key="feat_sdk_...",
    url="https://data-01.feat.so",  # optional; this is the default
))
client.ready()

ctx = EvalContext(
    targeting_key="user-123",
    kinds={"user": {"plan": "pro", "email": "alice@example.com"}},
)

if client.get_boolean_value("checkout-v2", False, ctx):
    # ...
    pass

client.close()

Use a server API key (feat_sdk_...).

How it works

  • Fetches a per-environment datafile and keeps it in memory.
  • Streams live updates by default over Server-Sent Events: a background thread holds the connection and applies each pushed datafile the moment it changes.
  • A background poll runs alongside the stream as a safety net. Its cadence follows stream health: while the stream is connected the poll runs at a slow 10-minute interval (the stream is the live path, so the poll only guards against a silently wedged connection); when streaming is off or the stream drops, the poll reverts to the normal interval (poll_interval_seconds, 30s by default and configurable) and becomes the primary refresh path. A dropped stream switches back to the fast interval immediately. Polls are ETag-aware via If-None-Match, and the stream reconnects with exponential backoff.
  • Updates are version-ordered: a datafile is adopted only when its version is strictly newer than the one in memory, so the stream and poll never clobber each other.
  • Evaluation runs in-process: no per-flag network call.
  • close() stops the stream and poll threads cleanly.

Disabling streaming

Set streaming=False to rely on polling alone:

client = Client(ClientConfig(api_key="feat_sdk_...", streaming=False))

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

feat_sdk-0.3.1.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

feat_sdk-0.3.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file feat_sdk-0.3.1.tar.gz.

File metadata

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

File hashes

Hashes for feat_sdk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 efe750923435bc29ab382513d6326912475f3e2e1174add274d5a6da771e8ecc
MD5 7f94cb1f6e875530c92da64ee251fb70
BLAKE2b-256 6058a65016fffdafd139982710ec5479da801779eaa5db794a7879ee69f03366

See more details on using hashes here.

Provenance

The following attestation bundles were made for feat_sdk-0.3.1.tar.gz:

Publisher: publish.yml on feathq/python-sdk

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

File details

Details for the file feat_sdk-0.3.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for feat_sdk-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2360e649e825daa8b1545d1e63b60feadc25c73d87e79423ccbdc0a0e5a3e99b
MD5 c6b359b25fe0d1a2b0fd534c22481746
BLAKE2b-256 27853b0ceda7c8673a286fe11d1bbc5b8e2ef6cd2467d82612ee9c52fa9db51e

See more details on using hashes here.

Provenance

The following attestation bundles were made for feat_sdk-0.3.1-py3-none-any.whl:

Publisher: publish.yml on feathq/python-sdk

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