Python project scaffold managed with uv.
- Python 3.10+
- uv
uv add unleash-openfeature-python-providerFor local development, sync the project environment:
uv sync --devThis repository includes the OpenFeature provider verifier as a git submodule. After cloning, initialize it before running the full test suite:
git submodule update --init --recursiveIf the verifier submodule is intentionally updated, refresh it and commit the new submodule pointer:
git submodule update --remote --merge verifier
git statusfrom 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"),
)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-123uv buildBuild artifacts are written to dist/.
uv run pytestuv run ruff check
uv run ruff format
uv run basedpyright