Python provider for Unleash and OpenFeature.
Project description
Unleash OpenFeature Python Provider
Python project scaffold managed with uv.
Prerequisites
- Python 3.10+
- uv
Install
uv add unleash-openfeature-python-provider
For local development, sync the project environment:
uv sync --dev
Test Harness
This repository includes the OpenFeature provider verifier as a git submodule. After cloning, initialize it before running the full test suite:
git submodule update --init --recursive
If the verifier submodule is intentionally updated, refresh it and commit the new submodule pointer:
git submodule update --remote --merge verifier
git status
Use
from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from UnleashClient import UnleashClient
from unleash_openfeature_python_provider import UnleashFlagProvider
unleash_client = UnleashClient(
url="https://app.unleash-hosted.com/demo/api",
app_name="my-app",
custom_headers={"Authorization": "<client-api-key>"},
)
api.set_provider_and_wait(UnleashFlagProvider(unleash_client))
client = api.get_client()
enabled = client.get_boolean_value(
"my-feature",
False,
EvaluationContext(targeting_key="user-123"),
)
Example
uv run python examples/boolean_flag.py \
--url https://app.unleash-hosted.com/demo/api \
--api-key "$UNLEASH_API_KEY" \
--flag-key my-feature \
--targeting-key user-123
Build
uv build
Build artifacts are written to dist/.
Test
uv run pytest
Lint, Format, And Type Check
uv run ruff check
uv run ruff format
uv run basedpyright
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 unleash_openfeature_python_provider-0.1.0a1.tar.gz.
File metadata
- Download URL: unleash_openfeature_python_provider-0.1.0a1.tar.gz
- Upload date:
- Size: 86.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c500ab21fb908ae25c941079cbe815830d6c1233d24af80d323f462ed79f3f68
|
|
| MD5 |
a43b80a12b85b5d197fca0d57b8b4584
|
|
| BLAKE2b-256 |
8e69de0af81e643e39c63f503e8b4f45956cd76468336a9fa114e617635cdfee
|
File details
Details for the file unleash_openfeature_python_provider-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: unleash_openfeature_python_provider-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
549d2c56233c159c10e392bdf11ab33495041c84b2cd777897302eca55bcf866
|
|
| MD5 |
9fce1b0f92709a35ddb5da0c5abace2e
|
|
| BLAKE2b-256 |
8b5f74dd152a6d371590760f5ea652e9e96d5d9aa75cb6dc50ba4cb97457ebd8
|