Skip to main content

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


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file unleash_openfeature_python_provider-0.1.0a2.tar.gz.

File metadata

  • Download URL: unleash_openfeature_python_provider-0.1.0a2.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unleash_openfeature_python_provider-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 e7273ccd6d0d14b6e59bd76f0e6d09c0d9167390372193792551ddbb1fa6bcf3
MD5 83172902bda50129f72a86c21ef06da7
BLAKE2b-256 20036a6f68adf0c4cfd70cad17573b3ebecff631ebe28f5e50bb076b8864bc53

See more details on using hashes here.

File details

Details for the file unleash_openfeature_python_provider-0.1.0a2-py3-none-any.whl.

File metadata

  • Download URL: unleash_openfeature_python_provider-0.1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unleash_openfeature_python_provider-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ac1d01bdc1902275fbae27f0b597d4c022162a2dfe90b77be4d314af133d9e5
MD5 2628402a735cff303b1a000b4a9e7b11
BLAKE2b-256 852388716ee2fa6c31eb81be3bb62a61a3b8bba8cc8ad98c73b12abc4f9a4a02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page