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 (every 30 seconds by default, configurable; ETag-aware via If-None-Match). If the stream drops, the poll keeps the datafile fresh while 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.2.0.tar.gz (21.4 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.2.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: feat_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 21.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 ef9a44c58ff3f9fb78a6f41ccec61337e1d8b14cba0c3bf35be8ab50618baf5b
MD5 3ddc08bd440ccc8063f8eb7de4c9a06b
BLAKE2b-256 430cc0013c4e7f66369026a93e4d246435ce3fad786c544d71303b3d68d78eb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for feat_sdk-0.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: feat_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab396f9740f411d22f7d71a83c203959332aa56c2caf6cfd4de5de78c5b9ebc2
MD5 efff9f5bd869e6809491271e4aed7c44
BLAKE2b-256 0fc8720605b3568e2c55619c7455e844fd8069c4a8e454209ee93cd60c906deb

See more details on using hashes here.

Provenance

The following attestation bundles were made for feat_sdk-0.2.0-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