Skip to main content

confeature-client (Python)

Python SDK for Confeature — a drop-in replacement for ConfigCat's official configcat-client Python SDK. Migrate by changing the import name and the SDK key value; no code changes needed.

Install

# Using uv (recommended)
uv add confeature-client

# Using pip
pip install confeature-client

Requires Python 3.10+.

Quickstart

from confeature_client import ConfeatureClient, User

with ConfeatureClient(sdk_key="configcat-sdk-1/...") as client:
    user = User(identifier="alice@example.com")
    enabled = client.get_value("feature.dark-mode", default=False, user=user)
    print(f"dark mode: {enabled}")

OpenFeature

Install the extra on Python 3.10 or later.

pip install 'confeature-client[openfeature]'

Register the provider with the official OpenFeature SDK. Pass a Confeature client configured without a default user.

from confeature_client import ConfeatureClient
from confeature_client.openfeature import ConfeatureProvider
from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from openfeature.provider.no_op_provider import NoOpProvider

with ConfeatureClient(sdk_key="YOUR-CONFEATURE-KEY") as sdk:
    api.set_provider_and_wait(ConfeatureProvider(sdk), domain="app")
    try:
        client = api.get_client(domain="app")
        context = EvaluationContext("user-123", {"Country": "FR", "Plan": "pro"})
        enabled = client.get_boolean_value("feature.dark-mode", False, context)
    finally:
        api.set_provider_and_wait(NoOpProvider(), domain="app")

Registration completes without fetching or waiting for flag data. The example resets only the app provider when evaluation finishes. The application owns the Confeature client and closes it at the end of the block. AutoPoll, LazyLoad and ManualPoll keep their SDK behavior. A cold cache with no data returns the caller's default with PROVIDER_NOT_READY until polling or a caller refresh loads a config. Async scalar evaluations run on a worker thread so a LazyLoad refresh leaves the event loop available.

The OpenFeature 0.10.0 async client can raise UnboundLocalError if a task is cancelled during evaluation. If your application needs standard cancellation, use await asyncio.to_thread(client.get_boolean_value, key, default, context) with the synchronous OpenFeature client method. Started work can still finish after cancellation. Let it finish before closing the Confeature client.

The provider maps the OpenFeature targeting key to the Confeature user identifier. Use Email and Country for the corresponding SDK attributes. Other supported scalar, datetime and string-array attributes are copied into the user's custom attributes. Boolean, string, integer and finite float results use exact types and include the SDK variation ID when available. An unknown flag returns FLAG_NOT_FOUND. Incompatible types and object evaluations return TYPE_MISMATCH.

Polling modes

Mirrors configcat-client: pick one of AutoPoll() (default, daemon thread polls every 60s), LazyLoad() (fetch on first stale read), or ManualPoll() (only on explicit client.force_refresh()).

from confeature_client import ConfeatureClient, ManualPoll

client = ConfeatureClient(sdk_key="...", polling_mode=ManualPoll())
client.force_refresh()

Flag overrides

Use FlagOverrides(MapOverrideDataSource({...}), OverrideBehaviour.LOCAL_ONLY) to bypass the network entirely (tests, local dev):

from confeature_client import (
    ConfeatureClient,
    FlagOverrides,
    MapOverrideDataSource,
    OverrideBehaviour,
)

client = ConfeatureClient(
    sdk_key="...",
    flag_overrides=FlagOverrides(
        data_source=MapOverrideDataSource({"feature.x": True}),
        behaviour=OverrideBehaviour.LOCAL_ONLY,
    ),
)
assert client.get_value("feature.x", default=False) is True

LOCAL_OVER_REMOTE and REMOTE_OVER_LOCAL are accepted at the type level but raise NotImplementedError at evaluation time (deferred per the parent monorepo's spec 031 §R8).

Migrate from ConfigCat

- import configcatclient
+ from confeature_client import ConfeatureClient
- client = configcatclient.create_client("YOUR-CONFIGCAT-KEY")
+ client = ConfeatureClient(sdk_key="YOUR-CONFEATURE-KEY")

Confeature SDK keys have ConfigCat's own shape, configcat-sdk-1/<22>/<22>, so a key copied from the Confeature dashboard also works in the stock configcat-client. Keys minted before that, confeature-sdk-1-<32>-<32>, are still accepted (is_valid_confeature_key_format checks both).

Method signatures, polling options, flag-overrides semantics, and User field names all mirror configcat-client. The corpus parity tier (tests/parity/test_parity_corpus.py) gates byte-identical output across 58 (flag, user, default) tuples.

Documentation & support

License

MIT. See LICENSE at the package root.

Metadata

Release files for confeature-client 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for confeature-client 0.2.0
File Size Uploaded Provenance Actions
confeature_client-0.2.0.tar.gz 60.2 kB With provenance Details for confeature_client-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for confeature-client 0.2.0
File Interpreter ABI Platform Actions
confeature_client-0.2.0-py3-none-any.whl Python 3 none any Details for confeature_client-0.2.0-py3-none-any.whl

Total release size: 132.0 kB

Release files / confeature_client-0.2.0.tar.gz

Download URL confeature_client-0.2.0.tar.gz
Size 60.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d5a26ab58a6e1f7ac53b1dc6f1521e3c33d6bbb37c70de7acec021480d15a951
BLAKE2b-256 checksum
How to use checksums
1faba32b0a01a6062294e7a329ee9002f71d6051d69af12e5a2146f6b1ca2953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / confeature_client-0.2.0-py3-none-any.whl

Download URL confeature_client-0.2.0-py3-none-any.whl
Size 71.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe91f59ec02a4d0b45d09b70e722d15c38503e20ad794f99eac64c3b0a41e1b5
BLAKE2b-256 checksum
How to use checksums
82c6246e95fc7878ada877db5d71586cc3e3a66b329cdcfb35f04dd8fcecfc60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for confeature-client 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for confeature_client-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page