Metadata-Version: 2.5
Name: e-volv-openfeature
Version: 0.1.0
Summary: OpenFeature provider for e-volv Launch flags.
Project-URL: Homepage, https://github.com/Pactify-Pty-Ltd/theevolve/tree/main/packages/openfeature-py
Project-URL: Source, https://github.com/Pactify-Pty-Ltd/theevolve
License: MIT
Requires-Python: >=3.10
Requires-Dist: e-volv-logs>=0.2.0
Requires-Dist: openfeature-sdk>=0.8
Description-Content-Type: text/markdown

# e-volv-openfeature

OpenFeature provider for [e-volv Launch](https://github.com/Pactify-Pty-Ltd/theevolve) flags, on top of the `e-volv-logs` Python SDK.

Evaluation underneath stays synchronous and never raises (the e-volv Launch SDK contract); only `initialize` waits — and only because OpenFeature's provider handshake asked it to.

## Usage

```python
from openfeature import api
from openfeature.evaluation_context import EvaluationContext

from evolve_logs import LogsClient, FlagsOptions
from evolve_openfeature import EvolveProvider

logs = LogsClient(
    key="evk_…", url="https://api.e-volv.io/api/public/v1/logs", flags=FlagsOptions()
)
api.set_provider(EvolveProvider(logs.flags))

client = api.get_client()
details = client.get_boolean_details(
    "checkout.new",
    False,
    EvaluationContext(targeting_key="u_1", attributes={"plan": "pro"}),
)
details.value, details.variant, details.flag_metadata["evolveReason"]
```

## Reason and error mapping

| e-volv reason            | OpenFeature `reason` | `error_code`     |
| ------------------------ | -------------------- | ---------------- |
| `RULE:*`, `TARGET_MATCH` | `TARGETING_MATCH`    | —                |
| `ROLLOUT`                | `SPLIT`              | —                |
| `OFF`, `KILLED`          | `DISABLED`           | —                |
| `FLAG_NOT_FOUND`         | `ERROR`              | `FLAG_NOT_FOUND` |
| `TYPE_MISMATCH`          | `ERROR`              | `TYPE_MISMATCH`  |
| `ERROR`                  | `ERROR`              | `GENERAL`        |
| anything else            | `DEFAULT`            | —                |

The native e-volv reason is always preserved as `flag_metadata["evolveReason"]`.
