Skip to main content

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 unleash_openfeature_python_provider import UnleashFlagProvider

# The provider builds and owns the Unleash client. Pass the same options you
provider = UnleashFlagProvider(
    url="https://app.unleash-hosted.com/demo/api",
    app_name="my-app",
    custom_headers={"Authorization": "<client-api-key>"},
)

api.set_provider_and_wait(provider)

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unleash_openfeature_python_provider-0.1.0.tar.gz (91.1 kB view details)

Uploaded Source

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.0.tar.gz.

File metadata

  • Download URL: unleash_openfeature_python_provider-0.1.0.tar.gz
  • Upload date:
  • Size: 91.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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.0.tar.gz
Algorithm Hash digest
SHA256 0d563e8541c9090d861f2cdabf76c6064365de7f31c4a2296e79a23199029fab
MD5 cd6d31e68f00f66c689bd7c408c40306
BLAKE2b-256 af9a51389cb3bab594a9e288439fcc44eaf35dce19f4f972ca670d02f7493723

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unleash_openfeature_python_provider-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4653f39fbbd0a2a9e4001c452d6873d69b9baed3a03305bc6fd2d3f25ccb5678
MD5 2999ad7c0cafac83e4cd1cd73673ea10
BLAKE2b-256 7c7465523261f0dcf7e93a423e1d77b5d88f889cfd43c74ca688a14c57af02f9

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 Sentry Error logging StatusPage Status page