Skip to main content
westyx-nexus-openfeature ships NexusProvider, an AbstractProvider implementation for the OpenFeature Python SDK. The provider wraps an already-initialized NexusClient and delegates all evaluations to its in-memory cache. No additional I/O or network calls are made by the provider itself. Available since v0.8.0.

Installation

The provider is a separate package - install it alongside the main SDK:
Both packages are hosted in the same GitLab PyPI registry. Add the registry URL first if you have not already done so (see Installation).

Quick start

Evaluation mapping

Integer evaluation accepts an int and an integral float (5.0); a bool, a string and 2.5 are a TYPE_MISMATCH. Float evaluation accepts an int and a float; a bool and a numeric string are a TYPE_MISMATCH.
Numbers are not coerced. int("7") is 7 and int(True) is 1 - bool is a subclass of int in Python - so converting would report a successful STATIC resolution carrying a value the config does not hold. JSON has a single number type, which is why an integral float still counts as an integer.

Per-user targeting

(v0.12.0+) A boolean evaluation carrying a targeting key is resolved through the AB Testing add-on, so the flag’s rollout percentage and cohort rules apply to that identity:
Without a targeting key the snapshot value is returned as before, so a consumer that passes no identity is unaffected. One request per identity. The provider asks about every flag the snapshot knows, not only the one being evaluated, so resolving five flags for one user costs one call. Requests are chunked at the endpoint’s 200-key limit, results are memoised per identity and flag (30 seconds by default), and concurrent evaluations for one identity coalesce into a single request. A key the snapshot does not have is never sent: the endpoint answers false for a flag it does not know, so sending it would override a caller’s True default while reporting a successful targeted evaluation. A failed request answers with the snapshot value rather than an error, because the specification makes an error resolution return the caller’s default - which would report False for a flag that is genuinely on. Without the add-on the snapshot is authoritative, so that case is STATIC and the provider goes quiet for five minutes; the suppression expires on its own and any success clears it, so buying the add-on takes effect without a restart. Cohort attributes come from the context, string values only. A non-string attribute is dropped and named in the provider’s logger rather than stringified. The targeting key travels in its own request field and is not repeated as an attribute. Non-boolean resolutions read configs, which have no per-user dimension in Nexus, so they ignore the context.

Options

Every value is validated at construction, naming the option: a targeting_ttl of 0 accepted quietly would turn every evaluation into a network call.

Error details

Use get_*_details instead of get_*_value to inspect the full resolution: