Skip to main content

Python Confidence SDK

⚠️ This SDK is in maintenance mode. We recommend migrating to the Confidence Resolver Python OpenFeature Provider, which offers better resilience and lower latency.

This SDK will continue to receive critical bug fixes but no new features.

This repo contains the Confidence Python SDK and the Confidence OpenFeature provider. We recommend using the OpenFeature Python SDK to access Confidence feature flags.

To learn more about the basic concepts (flags, targeting key, evaluation contexts), the OpenFeature reference documentation or the getting started guide can be useful.

Install

pip install

pip install spotify-confidence-sdk==3.0.3

This installs the full SDK including telemetry support and is the suggested .

Minimal installation (without telemetry)

For environments where you cannot use protobuf, you can install without protobuf (which disables telemetry):

pip install spotify-confidence-sdk==3.0.3 --no-deps
pip install requests==3.0.3 openfeature-sdk==0.4.2 typing_extensions==4.9.0 httpx==0.27.2

requirements.txt

# Full installation (recommended)
spotify-confidence-sdk==3.0.3

pip install -r requirements.txt

Usage

Creating the SDK

The OpenFeature provider is created by using the SDK. More details on how to setup the SDK can be found here.

from confidence.confidence import Confidence
from openfeature import api
from confidence.openfeature_provider import ConfidenceOpenFeatureProvider

provider = ConfidenceOpenFeatureProvider(Confidence(api_client, timeout_ms=500))
api.set_provider(provider)

Resolving flags

Flag values are evaluated remotely and returned to the application by using the OpenFeature client:

from openfeature import api

client = api.get_client()
user_identifier = "" # your identifier for a specific user

flag_value = client.get_string_value("flag-name.property-name", "my-default-value", api.EvaluationContext(attributes={"user_id": user_identifier}))
print(f"Flag value: {flag_value}")

Configuration options

The SDK can be configured with several options:

from confidence.confidence import Confidence, Region

confidence = Confidence(
    client_secret="CLIENT_TOKEN",
    region=Region.EU,  # Optional: defaults to GLOBAL
    timeout_ms=5000,  # Optional: specify timeout in milliseconds for network requests (default: 10000ms)
    custom_resolve_base_url="https://my-custom-endpoint.org" # we will append /v1/flags:resolve to this for the resolve endpoint.
)

Logging

The SDK includes built-in logging functionality to help with debugging and monitoring. By default, the SDK creates a logger named confidence_logger that outputs to the console with DEBUG level logging enabled.

Default logging behavior

When you create a Confidence client without specifying a logger, debug-level logging is automatically enabled:

from confidence.confidence import Confidence

# Debug logging is enabled by default
confidence = Confidence("CLIENT_TOKEN")

This will output log messages such as flag resolution details, error messages, and debug information to help troubleshoot issues.

Using a custom logger

You can provide your own logger instance to customize the logging behavior:

import logging
from confidence.confidence import Confidence

# Create a custom logger with INFO level (less verbose)
custom_logger = logging.getLogger("my_confidence_logger")
custom_logger.setLevel(logging.INFO)

confidence = Confidence("CLIENT_TOKEN", logger=custom_logger)

Disabling debug logging

To reduce log verbosity, you can configure a logger with a higher log level:

import logging
from confidence.confidence import Confidence

# Create a logger that only shows warnings and errors
quiet_logger = logging.getLogger("quiet_confidence_logger")
quiet_logger.setLevel(logging.WARNING)

confidence = Confidence("CLIENT_TOKEN", logger=quiet_logger)

Telemetry

The SDK includes telemetry functionality that helps monitor SDK performance and usage. By default, telemetry is enabled and collects metrics (anonymously) such as resolve latency and request status. This data is used by the Confidence team to improve the product, and in certain cases it is also available to the SDK adopters.

Telemetry behavior

  • Default installation: Telemetry is enabled automatically when protobuf dependencies are available
  • Minimal installation: Telemetry is automatically disabled when protobuf is not installed (see minimal installation)
  • Manual control: You can explicitly disable telemetry even when dependencies are available

Disabling telemetry

You can explicitly disable telemetry by setting disable_telemetry=True when initializing the Confidence client:

confidence = Confidence("CLIENT_TOKEN",
    disable_telemetry=True
)

Metadata

Release files for spotify-confidence-sdk 3.0.3

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

Source distribution (sdist)

Source distribution for spotify-confidence-sdk 3.0.3
File Size Uploaded Provenance Actions
spotify_confidence_sdk-3.0.3.tar.gz 44.3 kB With provenance Details for spotify_confidence_sdk-3.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spotify-confidence-sdk 3.0.3
File Interpreter ABI Platform Actions
spotify_confidence_sdk-3.0.3-py3-none-any.whl Python 3 none any Details for spotify_confidence_sdk-3.0.3-py3-none-any.whl

Total release size: 104.3 kB

Release files / spotify_confidence_sdk-3.0.3.tar.gz

Download URL spotify_confidence_sdk-3.0.3.tar.gz
Size 44.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b040a6709e198f993f47a24dae98162ebb56b60503f8013bc7fce835196d85a4
BLAKE2b-256 checksum
How to use checksums
d65b111a7c0419ad2d49d408f5c174e01ad75bb23e36c87bce838522b9bd456e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jun 25, 2026.

Transparency log

Release files / spotify_confidence_sdk-3.0.3-py3-none-any.whl

Download URL spotify_confidence_sdk-3.0.3-py3-none-any.whl
Size 60.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95a8a7dfb52d6518314382ef05e93dea1d863c3bd07ed9769d4f30de55873d15
BLAKE2b-256 checksum
How to use checksums
32eb8156fdd38704d5acfb48e47dd8e5b6280c5fc7557e2b62199eb4906c5461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jun 25, 2026.

Transparency log

Security for spotify-confidence-sdk 3.0.3

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spotify_confidence_sdk-3.0.3.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 Jun 25, 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