OpenFeature provider for Quonfig — Python server-side SDK
Project description
quonfig-openfeature
OpenFeature provider for Quonfig -- Python server-side SDK.
This package wraps the quonfig native SDK and implements the
OpenFeature Python server-side AbstractProvider
interface.
Install
pip install quonfig-openfeature quonfig openfeature-sdk
Usage
from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from quonfig_openfeature import QuonfigProvider
provider = QuonfigProvider(
sdk_key="qf_sk_production_...",
# targeting_key_mapping="user.id", # default
)
api.set_provider(provider)
client = api.get_client()
# Boolean flag
enabled = client.get_boolean_value("my-feature", False)
# String config
welcome = client.get_string_value("welcome-message", "Hello!")
# Number config
timeout_ms = client.get_integer_value("request-timeout-ms", 5000)
# Object config (JSON or string_list)
allowed_plans = client.get_object_value("allowed-plans", [])
# With evaluation context (per-request)
is_pro = client.get_boolean_value(
"pro-feature",
False,
EvaluationContext(
targeting_key="user-123", # maps to user.id by default
attributes={
"user.plan": "pro",
"org.tier": "enterprise",
},
),
)
Context mapping
OpenFeature context is flat; Quonfig context is nested by namespace. This provider maps between them using dot-notation:
| OpenFeature context key | Quonfig namespace | Quonfig property |
|---|---|---|
targeting_key |
user |
id (configurable via targeting_key_mapping) |
"user.email" |
user |
email |
"org.tier" |
org |
tier |
"country" (no dot) |
"" (default) |
country |
"user.ip.address" |
user |
ip.address (first dot only) |
Customizing targeting_key mapping
provider = QuonfigProvider(
sdk_key="qf_sk_...",
targeting_key_mapping="account.id", # maps targeting_key to {account: {id: ...}}
)
Accessing native SDK features
The get_client() escape hatch returns the underlying quonfig.Quonfig
client for features not available in OpenFeature:
native = provider.get_client()
# Log level integration
should_log = native.should_log(
config_key="log-level.auth",
desired_level="DEBUG",
contexts={"user": {"id": "user-123"}},
)
# List all config keys
keys = native.keys()
What you lose vs. the native SDK
OpenFeature is designed for feature flags, not general configuration. Some
Quonfig features require the native quonfig SDK:
- Log levels --
should_log()is native-only. string_listconfigs -- accessed viaget_object_value(), returned as a Pythonlist[str].durationconfigs -- return the raw float seconds viaget_float_value()(or useget_duration()natively).bytesconfigs -- not accessible via OpenFeature (no binary type in OF).keys()and raw config access -- native-only viaget_client().- Context keys use dot-notation --
"user.email", not nested objects. targeting_keymaps touser.idby default -- configuretargeting_key_mappingif different.
Configuration changed events
The provider extends OpenFeature's AbstractProvider, so you can register
event handlers via the standard api if you want to know when configs
update. The native quonfig SDK pushes live updates over SSE; surfacing
those as PROVIDER_CONFIGURATION_CHANGED events is on the roadmap.
Development
poetry install
poetry run ruff check .
poetry run pytest -v
The package depends on the local sibling sdk-python/ repo via a Poetry
path dependency; CI checks that out as a sibling directory and installs
the same way.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quonfig_openfeature-0.0.5.tar.gz.
File metadata
- Download URL: quonfig_openfeature-0.0.5.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
414fe4af7999c356a5cec86b4bd7b2a3b4b929732bad2e422cd54553d707fe8d
|
|
| MD5 |
58f80ddf347441ea79ab6ede4616fd1d
|
|
| BLAKE2b-256 |
77436bf0193085cd18f09d644e1435d07656ff3ed86015f7f59229d8c1d039aa
|
Provenance
The following attestation bundles were made for quonfig_openfeature-0.0.5.tar.gz:
Publisher:
release.yaml on quonfig/openfeature-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quonfig_openfeature-0.0.5.tar.gz -
Subject digest:
414fe4af7999c356a5cec86b4bd7b2a3b4b929732bad2e422cd54553d707fe8d - Sigstore transparency entry: 1435987369
- Sigstore integration time:
-
Permalink:
quonfig/openfeature-python@79d99ab8fb1cc84ff520f5d7ef034852967d4a65 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/quonfig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@79d99ab8fb1cc84ff520f5d7ef034852967d4a65 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quonfig_openfeature-0.0.5-py3-none-any.whl.
File metadata
- Download URL: quonfig_openfeature-0.0.5-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5abd14b31ebe1b0239b799aca4f775ae950cfc17efaab93356619f790d9c5f9a
|
|
| MD5 |
51328fdf24a7fcc62ac1cec9e26ba158
|
|
| BLAKE2b-256 |
042ea6c6bef3312bb3b53861c8ae01bde2486eca9e68de79ac1d812e50fe7acb
|
Provenance
The following attestation bundles were made for quonfig_openfeature-0.0.5-py3-none-any.whl:
Publisher:
release.yaml on quonfig/openfeature-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quonfig_openfeature-0.0.5-py3-none-any.whl -
Subject digest:
5abd14b31ebe1b0239b799aca4f775ae950cfc17efaab93356619f790d9c5f9a - Sigstore transparency entry: 1435987372
- Sigstore integration time:
-
Permalink:
quonfig/openfeature-python@79d99ab8fb1cc84ff520f5d7ef034852967d4a65 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/quonfig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@79d99ab8fb1cc84ff520f5d7ef034852967d4a65 -
Trigger Event:
push
-
Statement type: