Skip to main content

Superposition Provider

Superposition provider is an openfeature provider that works with Superposition to fetch feature flags, configurations, and experiment variants from a Superposition server, store it in-memory and do configuration resolutions based on dynamic contexts. Read the docs for more details.

Installation

Install the provider

pip install openfeature-sdk
pip install superposition-provider

Note: You will need to boot up Superposition before running the client code. Check the docs on how to get started with Superposition.

Initialization

To initialize the Superposition provider, you need to create a configuration. Create the provider object and then, you can set the provider using OpenFeature's API.

from openfeature import api
from superposition_provider.provider import SuperpositionProvider
from superposition_provider.types import ExperimentationOptions, SuperpositionProviderOptions, PollingStrategy

config_options = SuperpositionProviderOptions(
  endpoint="http://localhost:8080",
  token="api-token",
  org_id="localorg", 
  workspace_id="test",
  refresh_strategy=PollingStrategy(
      interval=5,  # Poll every 5 seconds
      timeout=3    # Timeout after 3 seconds
  ),
  fallback_config=None,
  evaluation_cache_options=None,
  experimentation_options=ExperimentationOptions(
      refresh_strategy=PollingStrategy(
          interval=5,  # Poll every 5 seconds
          timeout=3    # Timeout after 3 seconds
      )
  )
)

provider = SuperpositionProvider(provider_options=config_options)
# Initialize provider
await provider.initialize(context=ctx)
api.set_provider(provider)

Usage

Once the provider is initialized, you can evaluate feature flags and configurations using the OpenFeature client.

client = api.get_client()

ctx = EvaluationContext(
  targeting_key="25",  # Using a targeting key for experiment variant decider
  attributes={'d1': 'd1'}
)

bool_val = client.get_boolean_details(
    flag_key="bool",
    default_value=True,
    evaluation_context=ctx
)
# Note: If you want the whole config, you can directly use the provider itself
resp = provider.resolve_all_config_details({}, ctx)
print(f"Response for all config: {resp}")

print("Successfully resolved boolean flag details:", bool_val)

Metadata

Release files for superposition-provider 0.118.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for superposition-provider 0.118.0
File Interpreter ABI Platform
superposition_provider-0.118.0-py3-none-any.whl Python 3 none any Details

Release files / superposition_provider-0.118.0-py3-none-any.whl

Download URL superposition_provider-0.118.0-py3-none-any.whl
Size 11.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d28b283e5daa5393dbf54f477377063096eef52ec15fae3df305ea94c9913407
BLAKE2b-256 checksum
How to use checksums
62cbf09d88c3e7f6390b4cb10cfbb7683d49e3d76ab496057e398d34c02af9ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.118.1

1 release file

This release

0.118.0 This release

1 release file

0.115.5

1 release file

0.115.4

1 release file

0.114.0

1 release file

0.113.0

1 release file

0.112.0

1 release file

0.110.0

1 release file

0.109.0

1 release file

0.108.0

1 release file

0.107.1

1 release file

0.107.0

1 release file

0.106.0

1 release file

0.105.0

1 release file

0.104.0

1 release file

0.103.0

1 release file

0.102.0

1 release file

0.101.0

1 release file

0.100.2

1 release file

0.100.1

1 release file

0.100.0

1 release file

0.99.2

1 release file

0.99.1

1 release file

0.99.0

1 release file

0.98.0

1 release file

0.97.4

1 release file

0.97.3

1 release file

0.97.2

1 release file

0.97.1

1 release file

0.97.0

1 release file

0.96.1

1 release file

0.96.0

1 release file

0.95.1

1 release file

0.95.0

1 release file

0.94.5

1 release file

0.94.4

1 release file

0.94.3

1 release file

0.94.2

1 release file

0.94.1

1 release file

0.93.2

1 release file

0.93.1

1 release file

0.93.0

1 release file

0.92.0

1 release file

0.91.2

1 release file

0.91.1

1 release file

0.91.0

1 release file

0.90.0

1 release file

0.89.0

1 release file

0.88.1

1 release file

0.88.0

1 release file

0.87.0

1 release file

0.86.0

1 release file

0.85.1

1 release file

0.85.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page