Registry / devops / configcat-client

configcat-client

JSON →
library10.0.0pypypi✓ verified 24d ago

ConfigCat SDK for Python provides easy integration for your application to ConfigCat. It's a feature flag and configuration management service that lets you separate releases from deployments, enabling remote control over features. The library is actively maintained, with the current version being 10.0.0, and receives regular updates including new features and compatibility improvements.

pip install configcat-client
INSTALL
IMPORT
SIG · CONFIGCAT-CLIENT
C
configcat-client
devopspythonv10.0.0
Install
2.2s avg
Import
408ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v10.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.418s · 21.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.2s · import 0.398s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

configcatclient
import configcatclient
get
client = configcatclient.get("#YOUR-SDK-KEY#")
from configcatclient import create_client
Deprecated client creation functions (e.g., `create_client`, `create_client_with_auto_poll`) were removed in v8.0.0. Use `configcatclient.get()` for singleton client instances.
ConfigCatOptions
from configcatclient import ConfigCatOptions
PollingMode
from configcatclient import PollingMode
User
from configcatclient import User

This quickstart demonstrates how to initialize the ConfigCat client, retrieve a feature flag's value, and safely close the client. It also shows how to get a value for a specific user using a `User` object. Remember to replace `YOUR_SDK_KEY_HERE` with your actual ConfigCat SDK Key, ideally loaded from an environment variable.

import os import configcatclient # Get your SDK Key from ConfigCat Dashboard (e.g., via environment variable) SDK_KEY = os.environ.get('CONFIGCAT_SDK_KEY', 'YOUR_SDK_KEY_HERE') def main(): # Create a ConfigCat client instance (recommended as a singleton) client = configcatclient.get(SDK_KEY) # Get your setting value # The second argument is the default value if the key is not found is_my_awesome_feature_enabled = client.get_value('isMyAwesomeFeatureEnabled', False) if is_my_awesome_feature_enabled: print("Feature is ENABLED!") else: print("Feature is DISABLED.") # You can also get a value for a specific user user = configcatclient.User('some-user-id', email='user@example.com') is_feature_for_user = client.get_value('isMyAwesomeFeatureEnabled', False, user) print(f"Feature for user 'some-user-id': {is_feature_for_user}") # Stop ConfigCat client on application exit to release resources client.close() # Alternatively, configcatclient.close_all() to close all clients if __name__ == '__main__': main()
Debug
Known issues
breakingVersion 10.0.0 dropped support for Python 2.7, 3.5, 3.6, and 3.7. Attempting to use the library on these versions will result in `ImportError` or other compatibility issues.
fix
Upgrade to Python 3.8 or newer. Ensure your CI/CD pipelines and deployment environments use a supported Python version.
affects: >=10.0.0
breakingDeprecated client initialization functions like `configcatclient.create_client()`, `create_client_with_auto_poll()`, etc., were removed in v8.0.0. The `stop()` method was also renamed to `close()`.
fix
Replace calls to removed `create_client` functions with `client = configcatclient.get(sdk_key)`. Update `client.stop()` calls to `client.close()`.
affects: >=8.0.0
breakingVersion 9.0.0 introduced support for Config JSON v6 format. The older v5 format is no longer accepted for flag overrides, and the `User`'s `custom` dictionary now allows attribute values other than strings.
fix
If using local flag overrides, convert your config JSON files from v5 to v6 using the ConfigCat CLI tool. Update any code expecting `User` custom attributes to be strictly strings.
affects: >=9.0.0
gotchaIt is strongly recommended to use the ConfigCat Client as a singleton object throughout your application. `configcatclient.get()` returns a singleton instance for a given SDK key.
fix
Initialize the client once at application startup using `client = configcatclient.get(SDK_KEY)` and reuse this instance across your application rather than creating new ones.
affects: all
gotchaFailure to explicitly close the ConfigCat client on application exit can lead to resource leaks (e.g., open HTTP connections, lingering background threads for polling).
fix
Ensure `client.close()` is called for individual clients, or `configcatclient.close_all()` is called to shut down all clients, typically in a `finally` block or application shutdown hook.
affects: all
gotchaStarting from v8.0.0, passing an invalid SDK key format to `configcatclient.get()` will raise a `ConfigCatClientException` unless the client is configured for local-only flag overrides.
fix
Validate your SDK key format (it's a 22-character string consisting of Latin letters, numbers, and hyphens) before passing it to `configcatclient.get()`, or handle `ConfigCatClientException` gracefully.
affects: >=8.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'configcat-client'
The `configcat-client` package is not installed in your Python environment or is not accessible within your project's PYTHONPATH.
fix
Install the package using pip: `pip install configcat-client`
ConfigCat client initialization error (e.g., invalid SDK Key or data governance mismatch)
The ConfigCat client was initialized with an incorrect SDK Key, or the `data_governance` option in `ConfigCatOptions` does not match the data governance setting configured in the ConfigCat Dashboard. This prevents the client from fetching configuration data.
fix
Ensure your SDK Key is correct and that the `data_governance` option (e.g., `PollingMode.auto_poll(data_governance=DataGovernance.EU_ONLY)`) matches your project's settings in the ConfigCat Dashboard. For example:
```python
from configcatclient import ConfigCatOptions, PollingMode, DataGovernance
import configcatclient

# Correct SDK Key and Data Governance (example)
client = configcatclient.get(
    'YOUR_SDK_KEY',
    ConfigCatOptions(
        polling_mode=PollingMode.auto_poll(),
        data_governance=DataGovernance.GLOBAL  # Or DataGovernance.EU_ONLY
    )
)
# Remember to close the client when your application exits
# configcatclient.close_all()
```
ConnectTimeoutError (or similar network connection issue)
The ConfigCat SDK's HTTP client failed to establish a connection to the ConfigCat CDN servers within the allowed timeout period, often due to network issues, firewall restrictions, or an unavailable CDN.
fix
Check your network connectivity, ensure that `cdn.configcat.com`, `cdn-eu.configcat.com`, and `cdn-global.configcat.com` are whitelisted in your firewall, and verify the ConfigCat Service Status Monitor for any outages. You can also configure a longer `connect_timeout_seconds` in `ConfigCatOptions` if you suspect transient network delays:
```python
from configcatclient import ConfigCatOptions, PollingMode
import configcatclient

client = configcatclient.get(
    'YOUR_SDK_KEY',
    ConfigCatOptions(
        polling_mode=PollingMode.auto_poll(),
        connect_timeout_seconds=30  # Increase timeout (default is 10)
    )
)
```
Warning: Cannot evaluate targeting rules and % options for setting 'your_setting_key' (User Object is missing)
You are attempting to evaluate a feature flag or setting that has targeting rules or percentage options configured, but you are not providing a `User` object to the evaluation method. Without user attributes, the SDK cannot properly evaluate these rules.
fix
Pass a `User` object with relevant attributes to the evaluation methods (`get_value`, `get_value_details`, etc.) to enable proper targeting. For example:
```python
from configcatclient import ConfigCatClient, User

client = ConfigCatClient.get('YOUR_SDK_KEY')

user = User(
    identifier='user_id_123',
    email='test@example.com',
    country='US'
)

is_feature_enabled = client.get_value('your_setting_key', False, user)

# Don't forget to close the client when your application exits
# client.close()
```
Upgrade
Version history
10.0.0latest on PyPI · released Mar 10, 2026
Audit
Dependencies
requestsrequiredHTTP client for fetching configurations. Minimum version increased in v8.0.1 and v10.0.0.
semverrequiredUsed for semantic version parsing. Minimum version increased in v8.0.0.
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
configcat-client — pip install configcat-client · libregistry